Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (31 sloc) 1.36 KB
published title date author layout permalink tags
true
Auto generate AssemblyInfo.cs in .NET Core
2019-02-24 10:05:00 UTC
fabiocozzolino
post
/autogenerate-assemblyinfo-in-.net-core/
.NET
.NET Standard
.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 Cozzolinon</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), be sure the remove the AssemblyInfo.cs and set to true the GenerateAssemblyInfo in .csproj:

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

And that's all!

You can’t perform that action at this time.