如何更改asp.net核心中的程序集信息? [英] How to change assembly info in asp.net core?
问题描述
我想对我的 asp.net 核心应用进行版本控制.
我点击了这个链接:
更好的解决方案
一段时间后,我意识到最好的解决方案是使用 T4 文件,每次构建后版本都会自动递增.
看这里:
现在可以在 .csproj
或使用 AssemblyInfo.cs
中定义属性,但只有一个可以使用 place ,否则会产生重复"错误.
如果要使用AssemblyInfo.cs
,请将以下内容添加到.csproj
中以避免重复错误:
<GenerateAssemblyInfo>false</GenerateAssemblyInfo></PropertyGroup>
如果您对它的工作原理感兴趣,请查看 GenerateAssemblyInfo 任务.
<小时>否则,删除 AssemblyInfo.cs
并将以下属性添加到您的 .csproj
文件中:
<AssemblyVersion>1.2.3.4</AssemblyVersion></PropertyGroup>
I want to versioning my asp.net core app.
I followed this link: http://www.matthiaseinig.de/2013/05/20/auto-generate-fileversion-for-all-projects-in-a-solution-with-t4/ , but I want to remove project assembly info, but I didn't find it.
How to remove duplicated assembly info? I want to override asp core assemblies with another file.
BETTER SOLUTION
After a while I realize that the best solution is to use a T4 file, the version is incremented automatically after each build.
look here:
Right now properties could be defined in .csproj
or using AssemblyInfo.cs
, but only the one place could be used, otherwise "Duplicate" errors are generated.
If you want to use AssemblyInfo.cs
, add the following into .csproj
to avoid duplication errors:
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
If you are interesting how does it work, look into GenerateAssemblyInfo task.
Otherwise, remove AssemblyInfo.cs
and add the following property into your .csproj
file:
<PropertyGroup>
<AssemblyVersion>1.2.3.4</AssemblyVersion>
</PropertyGroup>
这篇关于如何更改asp.net核心中的程序集信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!