Naming main assembly (.exe) to avoid long file name: Company.Product.Application.exe
Background
When creating general class libraries, I mirror the Microsoft 开发者_如何学Go.NET Framework name structure, replacing System
with my own company name -- i.e., Tek4.Net.NetworkWidget
.
For product-specific assemblies, I use something like Tek4.ProductName.IO.FileWriter
.
Output .exe file names too long!!! Company.Product.SuperApp.exe
Visual Studio uses the full assembly name for output files; this is great for DLL's, but is too much for a console application -- i.e., Tek4.Utils.ConsoleApp.exe
Solution 1: (NOT PREFERRED)
Forego hierarchical names for main executable assemblies:
- Assembly name: ConsoleApp
- EXE File name: ConsoleApp.exe
This solution means your delivered .exe files will only contain a simple assembly name that fails to identify itself well, and is much more subject to name collisions with other assemblies. Stack traces, .NET Reflector, etc. will only show ConsoleApp
instead of a fully-qualified assembly name.
Solution 2: (MY CURRENT CHOICE)
Rename the output file after compilation while retaining the full internal assembly name (using a post-build event or manual rename):
- Assembly name: Tek4.Utilities.ConsoleApp
- EXE File name: Tek4.Utilities.ConsoleApp.exe --> ConsoleApp.exe
With this solution name collision is unlikely, and anywhere the assembly name shows up (i.e., stack traces, system event logs, etc.) it is easy to identify the source.
For some reason, I still hate the clunky manual rename, though.
Your Solutions and Practices?
Much thanks.
I'd also go with the shorter executable name, especially if it is expected to be used from the command line.
Having that said, what I have seen quite often, is the following convention if you have both a GUI version and a command line version of your application:
GUI: SuperApp.exe CLI: SuperApp.Console.exe
FWIW
My practice is same as Yours. And yes I would use short SuperApp.exe for the main executable. And hey if client sees stack traces something went wrong. So he better doesn't see your company's name in it ;)
Just a mere proposition:
YourCompany.YourProduct.Gui
YourCompany.YourProduct.Gui.Controllers
and you get the idea.
精彩评论