Berryl
Berryl

Reputation: 12833

assembly naming conventions

Assuming you have a namespace that is useful to more than one project in your company, in the format of "MyCompany.Core", would you have an assembly named exactly the same way or just "Core". Why or why not?

Upvotes: 5

Views: 10573

Answers (6)

Ali Bayat
Ali Bayat

Reputation: 4066

Based on Microsoft DLL naming conventions, I prefer the following pattern:

<Company>.<AppName>.<FeatureName>.<Layer>.dll

For example:

MyCompany.Sandwichery.Ordering.API

MyCompany.Sandwichery.Ordering.Domain

MyCompany.Sandwichery.Ordering.Infrastructure

Upvotes: 0

ChatGPT
ChatGPT

Reputation: 5617

if developing in a enterprise environment, this convention may be useful:

Namespaces follow the [DomainEntityName].[AssemblyName].[Purpose].[RelatedPurpose] format where the DomainEntityName is the root business functionality name and the AssemblyName is the functionally that is supporting the Business requirement.

Upvotes: 0

Zamir
Zamir

Reputation: 81

I prefer MyCompany.ApplicationName.Core.DLL, this eliminates the chances of conflict if there are two or more applications from MyCompany.

Upvotes: 4

Hans Passant
Hans Passant

Reputation: 941635

Use the standard .NET naming conventions, assembly names are covered here. I'll save you the (short) read:

Do choose names for your assembly DLLs that suggest large chunks of functionality such as System.Data. Assembly and DLL names do not have to correspond to namespace names but it is reasonable to follow the namespace name when naming assemblies.

Consider naming DLLs according to the following pattern:
<Company>.<Component>.dll
Where <Component> contains one or more dot-separated clauses.

For example, Contoso.WebControls.dll.

Upvotes: 13

Nick Craver
Nick Craver

Reputation: 630449

I believe it's best (opinion here!) to name the assembly after the root namespace it contains, in your case MyCompany.Core.dll. You never know if that file will make its way outside the company, and keeping track of it is just easier in general.

Imagine if Microsoft named System.Core just Core.dll (System.Core), then you had Core.dll (MyCompany.Core)....you imagine how that gets hairy fast.

Upvotes: 5

Andy White
Andy White

Reputation: 88375

I would name the assembly the same as the root namespace. This makes it easy to figure out what code is in which assembly, and prevents collisions with other projects (from other companies) that might also be using the ambiguious name "Core.dll".

Upvotes: 4

Related Questions