How to select an appropriate namespace for your library when you don't have a company name and you're not part of any organization?

#1

I want to publish one of my libraries as a nuget package for the first time, because I’ll reuse it quite often, and I find nuget packaging to be more convenient (and stable) than adding a remote .csproj every time, especially for people who might git clone my repositories on GitHub.

I never published a nuget package before so I didn’t have to deal with this issue before. But the problem is fairly simple: According to the best-practices of C# library development, each library should be prefixed with a namespace indicating an organization where it came from.

However, this enterprise-minded guideline completely ignores that I’m not part of any organization. So, how am I supposed to stay conventional and prefix my libraries with an appropriate namespace then? How do other single developers deal with this?

The only two options I thought of so far were:

  1. Choosing a permanent long-term namespace to prefix all of my libraries. The problem is that I don’t have any idea after what to name it, also that it doesn’t indicate “where it came from”.
  2. Prefixing my libraries with my surname or full name, but ins’t it just weird to see your name appears as an identifier to a package and library namespace?
#2

What is the name of the library? If it’s sufficiently unique, then I think it’s fine if you use just that. Keep in mind that the guidelines for namespaces are older than NuGet, which is why you needed a decentralized way to come up with a unique name. But with NuGet, you effectively have a centralized place for registering namespaces, and I think that makes it more okay to use less structured namespaces.

#3

“ANSITerm” - unfortunately it’s not unique at all, and there were at least 4 other nuget packages with similar names, and one of them had the identical name of my own library (and namespace), so then I realized that I have no choice but to use a prefix.

I thought about using my long term project as a prefix too, but then it’ll indicate as if the library “ANSITerm” is depended on other components of that larger project, whereas it’s just a tiny standalone library. Maybe using my surname for the package ID like that: “Tamar.ANSITerm” would make sense?

#4

That sounds good or how about Tamar.Tools? Maybe your next project will also be a tool.

#5

Hmm, I don’t know how I feel about this. To be honest, I don’t like the idea of using my name at all.

Yesterday I came up to the conclusion that I should use the namespace of my largest project as my default prefix.

But at this point I’m no longer sure if I want (or really need) to use nuget, and instead I’ll just keep using git to manage my repositories and link .csproj’s in every solution I might need them.

.NET Foundation Website | Blog | Projects | Code of Conduct