开发者

Specifying assembly version of all projects within a web deployment wdproj script

I have a .wdproj Web Deployment Project created with VS2010 that contains references to other class libraries, like this:

<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>

There are lots of these. I want to be a开发者_C百科ble to run msbuild /t:Rebuild /p:Configuration=Release and have all the assemblies of all the included projects compiled at a specified version. Nothing fancy just static like 2.5.6.0 and specified once in the wdproj file. I dont want to open 30 files manually.

I have looked at MSBuild Community Task and MSBuildExtension Pack and can not get anything to work. The build runs ok without errors.

Anyone have an example of how this can be done?

This is an attempt with MSBuild Extensions (adapted from the sample included) that doesn't work:

  <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 is definately looking at the MSBuild.ExtensionPack.Framework.AssemblyInfo element because if the attribute names are incorrect the build will fail. This builds ok but none of the versions on the referenced assemblies are changed. The version numbers on the ASP.NET page assemblies from the website are all 0.0.0.0.


Are you maybe missing to specify the CodeLanguage and OutputFile attributes? I think the AssemblyInfo task is intended to generate (replace) a source file prior to compiling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜