Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project and assembly naming conventions

There is Microsoft names of assemblies guideline but personally I don't like lengthy names in solution tree. When there are dozen of lengthy names it's hard to pick the project you want.

Do you keep project name same as assembly name or short it somehow?

For example if there is MyCompany.MyProject.Dal.dll assembly maybe it's more useful to name project simply Dal (but make it compilable into MyCompany.MyProject.Dal.dll) ?

Thank you in advance!

like image 578
Andrew Florko Avatar asked Jul 13 '10 05:07

Andrew Florko


People also ask

What is an assembly name?

An assembly's name is stored in metadata and has a significant impact on the assembly's scope and use by an application. A strong-named assembly has a fully qualified name that includes the assembly's name, culture, public key, version number, and, optionally, processor architecture.

How do you name a DLL?

Assembly and DLL names don't have to correspond to namespace names, but it is reasonable to follow the namespace name when naming assemblies. A good rule of thumb is to name the DLL based on the common prefix of the namespaces contained in the assembly. For example, an assembly with two namespaces, MyCompany.

How do I get a fully qualified assembly name?

If you know the assembly's file system path, you can call the static (C#) or Shared (Visual Basic) AssemblyName. GetAssemblyName method to get the fully qualified assembly name.

What is AC assembly?

An assembly is a file that is automatically generated by the compiler upon successful compilation of every . NET application. It can be either a Dynamic Link Library or an executable file. It is generated only once for an application and upon each subsequent compilation the assembly gets updated.


1 Answers

The project name (in common with the solution name) doesn't really matter to the output, as long as the project's "Assembly name:" and "Default namespace:" options are set correctly. So have fun, but I wouldn't take them too far from the namespace.

If your namespace is FooCorp.MegaProject.DAL.dll, then anyone with the project already knows they work for FooCorp, and they probably already have the project named on disk as MegaProject, so it probably isn't going to add much confusion to just have DAL.csproj, especially if this is in the path "...\FooCorp\MegaProject\DAL\DAL.csproj" or similar. I've certainly done this before (at my last job, where we had hundreds and hundreds of assemblies).

like image 140
Marc Gravell Avatar answered Nov 26 '22 04:11

Marc Gravell