2014-09-12 48 views
0

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

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. 
+0

上面的信息很少继续。为您的msbuild.exe调用添加详细信息。 msbuild.exe MySolution.sln /吨:重建/ P:配置=推出/冗长:详细 – granadaCoder 2014-09-12 15:15:52

+0

打开冗长产生以下输出,还有更多的这些线路在继续之前,但这是表现出错误的部分。谢谢您的帮助。 – fungus1487 2014-09-12 22:29:22

+0

你是否检查过类似的帖子? http://geekswithblogs.net/michelotti/archive/2006/07/31/86754.aspx – 2014-09-13 03:53:39

回答

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

只是已经回答的内容。

我们的案例:我们这是已经建立V4.0解决方案我们构建服务器(CCNET)上安装4.5.1 SDK和SDK安装后停止。

解决方案:将“C:\ Program Files(x86)\ MSBuild \ Microsoft \ WebDeployment \ v10.0 \ Microsoft.WebDeployment.targets”中的路径更改为“C:\ Program Files \ Microsoft SDKs \ Windows \ V7.1 \ BIN \ NETFX 4.0工具\ 64"

希望它能帮助。