Asp.net-Core

如何更改 asp.net 核心中的程序集資訊?

  • March 12, 2019

我想對我的 asp.net 核心應用程序進行版本控制。

我點擊了這個連結: http: //www.matthiaseinig.de/2013/05/20/auto-generate-fileversion-for-all-projects-in-a-solution-with-t4/,但我想刪除項目組裝資訊,但我沒有找到它。

如何刪除重複的程序集資訊?我想用另一個文件覆蓋 asp 核心程序集。

在此處輸入圖像描述 在此處輸入圖像描述 在此處輸入圖像描述

更好的解決方案

一段時間後,我意識到最好的解決方案是使用 T4 文件,每次建構後版本都會自動遞增。

看這裡:

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

現在可以在.csproj或 using中定義屬性AssemblyInfo.cs,但只能使用一個地方,否則會生成“重複”錯誤。


如果要使用AssemblyInfo.cs,請將以下內容添加到.csproj以避免重複錯誤:

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

如果您對它的工作原理感興趣,請查看GenerateAssemblyInfo 任務


否則,刪除AssemblyInfo.cs以下屬性並將其添加到您的.csproj文件中:

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

引用自:https://stackoverflow.com/questions/46727007