Web Deployment Project & TeamCity

7
我正在尝试为解决方案构建Web Deployment Project 2010项目。我已在构建服务器上安装了Windows SDK和Web Deployment Project 2010 RTW,并复制了缺少的MSBuild .target文件。但是,在尝试构建项目时,它会输出以下错误:
C:\Program Files\MSBuild\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.targets(1589, 9): error MSB6004: 指定的任务可执行位置“C:\Program Files\MSBuild\Microsoft\WebDeployment\v10.0\aspnet_merge.exe”无效。
不幸的是,谷歌搜索此错误并没有找到任何有用的结果。如果您能提供帮助以使TeamCity成功构建Web Deployment Project,则将不胜感激。
3个回答

4

好的,你的aspnet_merge指向了错误的位置 - 在我的构建脚本中,我已经有以下结论:

<ItemGroup>
    <ASPNETPath Include="F:\Program Files\Microsoft SDKs\Windows\v6.0A\bin" />
</ItemGroup>

<Target Name="ASPNET Merge">
    <AspNetMerge
      ExePath="@(ASPNETPath)"
      ApplicationPath=".\Release"
      SingleAssemblyName="CoreMicrosite"
      />
</Target>

尝试并查看。

1
很棒,我在 Microsoft.WebDeployment.targets 中设置了 aspnet_merge.exeExePathNETFX 4.0 Tools 目录,现在构建正常了。谢谢。 - Tom Bell

3
更适合的解决方案是在您的.wdproj文件中设置TargetFrameworkSDKDirectoryBin属性。例如:
<TargetFrameworkSDKDirectoryBin>C:\Programmi\Microsoft SDKs\Windows\v7.1\Bin\</TargetFrameworkSDKDirectoryBin>

此设置用于 .dtproj 文件中,覆盖了在 Microsoft.WebDeployment.targets 中定义的默认设置,如下所示:

<Target
  Name="GetAspNetMergePath"
  DependsOnTargets="$(GetAspNetMergePathDependsOn)">
  <PropertyGroup>
      <AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
      <AspnetMergePath>$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v10.0</AspnetMergePath>
      <AspnetMergePath Condition="Exists('$(TargetFrameworkSDKDirectoryBin)$(AspnetMergeName)')">$(TargetFrameworkSDKDirectoryBin)</AspnetMergePath>
  </PropertyGroup>
</Target>

第二个AspnetMergePath的意思是,如果其他地方存在一个指向现有aspnet_merge.exe文件的$(TargetFrameworkSDKDirectoryBin),则会使用此文件。


2

请在文件“Microsoft.WebDeployment.targets”的1562行更改以下节点:

    <Target
        Name="GetAspNetMergePath"
        DependsOnTargets="$(GetAspNetMergePathDependsOn)">
        <PropertyGroup>
            <AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
            <!-- OLD
            <AspnetMergePath>$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v10.0</AspnetMergePath>
            <AspnetMergePath Condition="Exists('$(TargetFrameworkSDKDirectoryBin)$(AspnetMergeName)')">$(TargetFrameworkSDKDirectoryBin)</AspnetMergePath>
            -->
            <AspnetMergePath>C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\</AspnetMergePath>
            <AspnetMergePath Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\</AspnetMergePath>
        </PropertyGroup>
    </Target>

我在相应的微软连接页面上添加了一个解决方法的评论:
http://connect.microsoft.com/VisualStudio/feedback/details/706047/visual-studio-2010-web-deployment


+1,因为其他答案假设 aspnet_merge.exe 在开发机器和构建服务器上的相同位置。这解决了问题,但请注意最新的 SDK 是 7.1,而不是 7.0A。 - si618

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接