15

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("Microsoft")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
shA.t
  • 16,580
  • 5
  • 54
  • 111
SteveC
  • 15,808
  • 23
  • 102
  • 173

5 Answers5

12

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

Amit G
  • 5,165
  • 4
  • 28
  • 29
  • Thanks for the pointer ... I've used the registry tip as it's a single place to edit, rather than having to go through each of the zip files, but knowing they are there is very useful – SteveC Sep 19 '11 at 09:16
  • It seems changing formatting of project template does not do anything, I rearranged year and organization but new project still uses old format. – Yuan Jan 15 '12 at 20:37
11

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?

Community
  • 1
  • 1
Samich
  • 29,157
  • 6
  • 68
  • 77
3

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

Jowen
  • 5,203
  • 1
  • 43
  • 41
  • 1
    I read the article in the link you provided. A lot of words to simply suggest "Use a linked file instead of a real file." – barrypicker Jul 30 '18 at 19:32
0

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

Steve
  • 531
  • 5
  • 16
0

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.

Community
  • 1
  • 1
Darren Lewis
  • 8,338
  • 3
  • 35
  • 55