在Web部署wdproj脚本中指定所有项目的程序集版本

时间:2010-12-23 19:03:45

标签: msbuild

我有一个使用VS2010创建的.wdproj Web部署项目,其中包含对其他类库的引用,如下所示:

<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 Pack,无法使用任何内容。构建运行正常,没有错误。

任何人都有一个如何做到这一点的例子?

这是尝试使用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。

1 个答案:

答案 0 :(得分:0)

您是否可能缺少指定CodeLanguage和OutputFile属性? 我认为AssemblyInfo任务旨在在编译之前生成(替换)源文件。

相关问题