我有一個包含到其他類庫引用這樣VS2010創建.wdproj Web部署項目中指定的所有項目的程序集的版本:網絡部署wdproj腳本
<Project ToolsVersion="4.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectReference Include="..\Path\Proj1.csproj">
<Project>{GUID-HERE}</Project>
<Name>Proj1</Name>
</ProjectReference>
<ProjectReference Include="..\Path\Proj2.csproj">
<Project>{GUID-HERE}</Project>
<Name>Proj2</Name>
</ProjectReference>
有很多的這些。我希望能夠運行msbuild /t:Rebuild /p:Configuration=Release
並將所有包含的項目的所有程序集編譯爲指定的版本。沒有什麼奇特的像2.5.6.0一樣靜態,並在wdproj文件中指定一次。我不想手動打開30個文件。
我看過MSBuild社區任務和MSBuildExtension包,無法獲得任何工作。構建運行正常,沒有錯誤。
任何人都有這樣的例子嗎?
這是的MSBuild Extensions的嘗試(改編自納入樣本)不工作:
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.VersionNumber.targets"/>
<Target Name="Build">
<MSBuild.ExtensionPack.Framework.AssemblyInfo
ComVisible="true"
AssemblyInfoFiles="VersionInfo.cs"
AssemblyFileMajorVersion="2"
AssemblyFileMinorVersion="5"
AssemblyFileBuildNumber="6"
AssemblyFileRevision="0"
/>
</Target>
的MSBuild是肯定看MSBuild.ExtensionPack.Framework.AssemblyInfo
元素,因爲如果屬性名稱不正確的構建就會失敗。這種構建可以,但引用程序集上的版本都不會更改。來自網站的ASP.NET頁面程序集的版本號都是0.0.0.0。
作爲替代,有http://weblogs.asp.net/srkirkland/archive/2010/12/07/simple-msbuild-configuration-updating-assemblies-with-a-version-number.aspx但需要一些首先重新安排每個項目的AssemblyInfo.cs細節。 – yanta 2010-12-24 15:10:16