Auto generate AssemblyInfo.cs in .NET Core

As you can see in my last post, I’m moving my TitiusLabs.Core PCL to .NET Standard. After project migration, you can choose to maintain AssemblyInfo - and in my previous post you can see how to do it - or move to an auto generation model, as we’ll see in this post.

To auto generate the AssemblyInfo.cs, simply put the following PropertyGroup element in your .csproj:

<PropertyGroup>
  <Company>TitiusLabs</Company>
  <Authors>Fabio Cozzolino</Authors>
  <PackageId>TitiusLabs.Core</PackageId>
  <Version>1.0.0</Version>
  <AssemblyVersion>1.0.0.0</AssemblyVersion>
  <FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>

To avoid the Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute (CS0579) remove the AssemblyInfo.cs and set to true the GenerateAssemblyInfo in .csproj:

<PropertyGroup>
   <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

And that’s all!

Found a problem? Edit this post