2
步驟1: 執行編輯爲以下的* PROJ文件在生成服務器錯誤:CS1730,更新後的項目
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.-->
<Target Name="BeforeBuild">
<Version VersionFile="..\VersionInfo.txt" RevisionType="Increment">
<Output TaskParameter="Major" PropertyName="Major" />
<Output TaskParameter="Minor" PropertyName="Minor" />
<Output TaskParameter="Build" PropertyName="Build" />
<Output TaskParameter="Revision" PropertyName="Revision" />
</Version>
<AssemblyInfo CodeLanguage="CS" OutputFile=".\Properties\AssemblyVersion.cs" AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" />
</Target>
<!--
<Target Name="AfterBuild">
</Target>
-->
步驟2: 取出的AssemblyVersion數量和的AssemblyFileVersion from AssemblyInfo.cs
步驟3: 在sln所在的位置外創建名爲VersionInfo.text的文件。
步驟3: 附上AssemblyVersionNumber.cs到項目的
第4步: 問題一個MSBuild的,做工精細的本地機器上,而不是在生成服務器上。
DevMachine:(32位)
C:\SVNHome\branches\MyGreatProject-II>msbuild -ver
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3643]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
BuildServer:上生成服務器是沒有幫助給出
D:\SVNHome\branches\source\MyGreatProject-II>%windir%\Microsoft.NET\Framework64\v3.5\msbuild
-ver
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.4234]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
錯誤消息。
Properties\AssemblyInfo.cs: error CS1730: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
那麼'AssemblyVersion.cs'在兩個系統上看起來像什麼? – jessehouwing 2013-04-26 15:22:00
問題,我現在有一個小問題。所有的項目都給我不同的增量數,我所有的二進制文件都不一樣。 – bhushanvinay 2013-04-26 16:04:25
您使用哪種構建服務器技術。您應該只爲一次構建調用增量。因此,您可能需要在建立所有項目的調用之前將它包括在內。 – jessehouwing 2013-04-26 17:20:05