Naming main assembly (.exe) to avoid long file name: Company.Product.Application.exe

怎甘沉沦 提交于 2019-12-23 15:39:20

问题


Background

When creating general class libraries, I mirror the Microsoft .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.


回答1:


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




回答2:


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 ;)




回答3:


Just a mere proposition:

YourCompany.YourProduct.Gui
YourCompany.YourProduct.Gui.Controllers

and you get the idea.



来源:https://stackoverflow.com/questions/6116178/naming-main-assembly-exe-to-avoid-long-file-name-company-product-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!