2011-07-07 103 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