2011-07-07 129 views
7

我正在尝试构建一个解决方案的Web部署项目2010项目。我在构建服务器上安装了Windows SDK和Web部署项目2010 RTW,并且复制了MSBuild缺失的.target文件。Web部署项目&TeamCity

当试图建立它吐出以下错误

C中的项目:\ Program Files文件\的MSBuild \微软\ WebDeployment \ V10.0 \ Microsoft.WebDeployment.targets(1589年9):错误MSB6004:指定的任务可执行文件位置“C:\ Program Files \ MSBuild \ Microsoft \ WebDeployment \ v10.0 \ aspnet_merge.exe”无效。

不幸的是,在Google搜索有关此错误的结果时,并未发现任何有价值的东西。不胜感激任何帮助TeamCity成功构建Web部署项目的帮助。

回答

3

更合适的解决方案应该是在您的.wdproj文件中设置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意味着,如果某处否则一个$(TargetFrameworkSDKDirectoryBin)指向一个现有的aspnet_merge.exe文件,这将被使用。

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'中的'NETFX 4.0 Tools'目录下为'aspnet_merge.exe'设置了'ExePath',并且它现在正确地建立了。谢谢 –

+0

优秀 - 很高兴它现在可以工作! – stack72

2

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

<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

+0

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