开发者

Setting the default values of AssemblyInfo.cs

开发者 https://www.devze.com 2023-04-06 07:32 出处:网络
What is the best way to change the default values that AssemblyInfo.cs is created with, e.g. I don\'t want the Microsoft bits in AssemblyCompany and AssemblyCopyright

What is the best way to change the default values that AssemblyInfo.cs is created with, e.g. I don't want the Microsoft bits in AssemblyCompany and AssemblyCopyright

[assembly: AssemblyCompany("Micro开发者_StackOverflow社区soft")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]


It appears that this info is embedded in the project template definition. For instance, if I create a project using the "Console Application" project template, it uses:

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\ConsoleApplication.zip

Looking inside that zip file there is an AssemblyInfo.cs file which contains:

[assembly: AssemblyCompany("$registeredorganization$")]
[assembly: AssemblyProduct("$projectname$")]
[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")]

So if you can't change the registration info of your machine like others have suggested, you could just update this file here


Probably only in registry:

32 bit: HKLM\Software\Microsoft\Windows NT\CurrentVersion
64 bit: HKLM\Software\Wow6432Node\Microsoft\WindowsNT\CurrentVersion

Changing the default values for AssemblyInfo.cs

Also here is the post on SO: How to change registration company name for Visual Studio 2008?


Little offtopic: Every project has its own assemblyinfo.cs. To keep things DRY, I'd recommend the usage of a GlobalAssemblyInfo


If you mean when you create a new VS Project it should default to your firm name, you can modify the project templates but this will need to be done on each dev machine.

If you're trying to alleviate the PITA of managing this common data in all of the assemblies in a solution you could use a SharedAssemblyInfo.cs file. Create this at the solution level then add to all of your other projects by adding it as a linked file (the Add Dialog box has a little flyout on the button). This approach is used commonly for assembly versioning

More info from this SO post also.


As an update, I found this location and updated all the assemblyinfo.cs files for the various project types (Visual Studio 2015, Windows 10). That seems to have worked:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ProjectTemplates\CSharp\Windows Root\Windows\1033

0

精彩评论

暂无评论...
验证码 换一张
取 消