br0ken.pipe
br0ken.pipe

Reputation: 910

Templating a generic AssemblyInfo.cs

I'm creating a project template in Visual Studio and I would like to make the AssemblyInfo.cs file a bit more generic. I need the values several times in my project and they are already defined under Resources.resx. Is there any way to (dynamically) build the AssemblyInfo.cs or do I need to hardcode every value?

[assembly: AssemblyTitle("Template")]
[assembly: AssemblyDescription("A simple template")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sample Company")]
[assembly: AssemblyProduct("Template")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("")]
[assembly: AssemblyVersion("")]
[assembly: AssemblyInformationalVersion("")]
[assembly: NeutralResourcesLanguage("")]

Upvotes: 2

Views: 1368

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 157118

I would use a linked file, placed outside your projects, where you store the shared properties. Then in a per-project AssemblyInfo.cs file, you put all the project-specific properties.

You can link files from the Project Explorer > Add > Existing Item option:

Upvotes: 2

Related Questions