简体   繁体   中英

Replacing company and product name in namespace and library names

The standard recommendation for names of namespaces goes like this:

 <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>] 

Similarly, for the names of assemblies Microsoft guidelines recommend:

 <Company>.<Component>.dll 

My place like many other small and medium sized companies went through several name changes as well as product name changes which make old namespace and assembly names obsolete. Changing it every year or two as marketing preferences change is quite a pain. Leaving the mix of the old and new namespaces is even bigger pain. In essence, I find the recommendation does not work well for many of us.

Anyone found a good way around it? Using 'technology' and 'component' instead of product name may help, but I am really struggling with what to use instead of company name? Maybe I should accept that these names are dynamic and need to be 're-factored' just like the code...

I've had a similar situation. A couple thoughts...

  1. Does your assembly naming matter? Is it visible to your customers? If your assembly names are visible, you could always change the name of the assemblies without changing the namespaces. Might be less of a pain. But if you're just deploying a server, and your customers will never see the assembly filenames, then maybe this isn't worth investing a lot of time in.

    (And yes, it kills a little part of me to write that. Because I hate stuff like this. But sometimes it's just not worth it.)

  2. Perhaps you could use a code-name for the product, and leave the company out. The codename could remain constant, or only change on major releases, when you would be updating references anyway.

  3. This is a bigger change, but... I've had some good luck running a NuGet server for my project's assemblies. This may help manage some of the pain of changing - publish a new package with the new name, and upgrade all the users of that package. Still a pain? Yup. But maybe easier to pull off than managing assembly references directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM