我有一个包含到其他类库引用这样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