-2146232576错误MSBuild

时间:2014-09-12 15:02:12

标签: msbuild

我正在使用.Net v4.5在我们的新构建服务器上运行MSBuild,用于ASP.Net MVC 5 C#项目,但是得到以下异常,但我找不到任何资源。

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(516, 5):
error MSB6006: "aspnet_merge.exe" exited with code -2146232576

打开MSBuild的详细程度,我得到以下内容。

[MyApp.csproj.teamcity] AspNetMerge
[22:19:22][AspNetMerge] Using "AspNetMerge" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\..\Microsoft.Web.Publishing.Tasks.dll".
[22:19:22][AspNetMerge] AspNetMerge
[22:19:22][AspNetMerge] Running aspnet_merge.exe.
[22:19:22][AspNetMerge] C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\aspnet_merge.exe C:\TeamCity\buildAgent\work\9cfa4fd6593d694d\MyApp\obj\Release\AspnetCompileMerge\TempBuildDir -o MyApp.Merged -copyattrs obj\Release\AssemblyInfo\AssemblyInfo.dll -a  
[22:19:22][AspNetMerge] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(516, 5): error MSB6006: "aspnet_merge.exe" exited with code -2146232576.

在浏览各种文章,网站和论坛后,我仍然没有找到明确的答案。然而,它导致我在我们的构建服务器(包括.Net版本2.0)上安装.Net Framework版本3.5,并且它已将异常更改为更通用的asp_net合并版本。但是,我并没有真正获得足够的信息来解决问题所在,我仍然认为这与我原来的问题有关。

[MyProject.csproj.teamcity] AspNetMerge (4s)
[18:46:36][AspNetMerge] Using "AspNetMerge" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\..\Microsoft.Web.Publishing.Tasks.dll".
[18:46:36][AspNetMerge] AspNetMerge (4s)
[18:46:36][AspNetMerge] Running aspnet_merge.exe.
[18:46:36][AspNetMerge] C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\aspnet_merge.exe C:\TeamCity\buildAgent\work\9cfa4fd6593d694d\MyProject\obj\Release\AspnetCompileMerge\TempBuildDir -o MyProject.Merged -copyattrs obj\Release\AssemblyInfo\AssemblyInfo.dll -a  
[18:46:36][AspNetMerge] Utility to merge precompiled ASP.NET assemblies. Version 3.5.30729.
[18:46:36][AspNetMerge] Copyright (c) Microsoft Corporation 2007. All rights reserved.
[18:46:36][AspNetMerge] 
[18:46:40][AspNetMerge] aspnet_merge error occurred: An error occurred when merging assemblies: Unresolved assembly reference not allowed: System.Web.
[18:46:40][AspNetMerge] The command exited with code 1.

2 个答案:

答案 0 :(得分:1)

经过反复试验(很多)AspNetMerge路径不正确。

文件位于:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets

有一个指向的部分:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0\bin\

我已经将.targets部分更改为:

<PropertyGroup>
  <AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
  <AspnetMergePath>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\</AspnetMergePath>
</PropertyGroup>

现在所有东西都按计划建造。

答案 1 :(得分:1)

只是对已经回答的内容的补充。

我们的案例:我们在构建服务器(Ccnet)上安装了4.5.1 sdk,它已经构建了v4.0解决方案并在安装sdk后停止了。

解决方案:更改了&#34; C:\ Program Files(x86)\ MSBuild \ Microsoft \ WebDeployment \ v10.0 \ Microsoft.WebDeployment.targets&#34;的路径。到&#34; C:\ Program Files \ Microsoft SDKs \ Windows \ v7.1 \ Bin \ NETFX 4.0 Tools \ x64&#34;

希望它有所帮助。