如何在asp.net核心中更改汇编信息?

时间:2017-10-13 09:43:26

标签: asp.net-core .net-core .net-assembly auto-versioning assembly-attributes

我想对我的asp.net核心应用进行版本控制。

我按照以下链接:http://www.matthiaseinig.de/2013/05/20/auto-generate-fileversion-for-all-projects-in-a-solution-with-t4/,但我想删除项目汇编信息,但我没有找到它。

如何删除重复的装配信息?我想用另一个文件覆盖asp核心程序集。

enter image description here enter image description here enter image description here

更好的解决方案

过了一段时间后,我意识到最好的解决方案是使用T4文件,每次构建后版本会自动递增。

看这里:

http://www.matthiaseinig.de/2013/05/20/auto-generate-fileversion-for-all-projects-in-a-solution-with-t4/

1 个答案:

答案 0 :(得分:12)

现在可以在.csprojAssemblyInfo.cs中定义属性,但只能使用一个地方,否则会生成“重复”错误。

如果您想使用AssemblyInfo.cs,请将以下内容添加到.csproj以避免重复错误:

<PropertyGroup>
  <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

如果您感兴趣它是如何工作的,请查看GenerateAssemblyInfo task

否则,请删除AssemblyInfo.cs并将以下属性添加到.csproj文件中:

<PropertyGroup>
  <AssemblyVersion>1.2.3.4</AssemblyVersion>
</PropertyGroup>