3
是否有一個MSBuild任務用於在AssemblyInfo.cs中設置自定義屬性? 我發現AssemblyInfo任務,但似乎它不能設置自定義屬性,只有預定義的屬性。我想設置我已經添加到這個文件中的3個自定義屬性。用於在AssemblyInfo.cs中設置自定義屬性的MSBuild任務
任何建議如何解決這個問題?
是否有一個MSBuild任務用於在AssemblyInfo.cs中設置自定義屬性? 我發現AssemblyInfo任務,但似乎它不能設置自定義屬性,只有預定義的屬性。我想設置我已經添加到這個文件中的3個自定義屬性。用於在AssemblyInfo.cs中設置自定義屬性的MSBuild任務
任何建議如何解決這個問題?
WriteCodeFragment
任務可以幫助:
<Target Name="BeforeBuild">
<ItemGroup>
<AssemblyAttributes Include="AssemblyTitle">
<_Parameter1>My Assembly</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyDescription">
<_Parameter1>My Assembly</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCompany">
<_Parameter1>My Company</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyProduct">
<_Parameter1>My Product</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCopyright">
<_Parameter1>Copyright © 2012</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCulture">
<_Parameter1></_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>1.0.0.0</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>1.0.0.0</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="System.Runtime.InteropServices.Guid">
<_Parameter1>e7a979b2-0a4f-483a-ba60-124e7ef3a931</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
<WriteCodeFragment Language="C#" OutputFile="Properties/AssemblyInfo.cs" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
謝謝,這做的伎倆! :) – Vajda
只支持.NET 4.0及更高版本:( –