fungus1487
fungus1487

Reputation: 1809

-2146232576 Error MSBuild

I am running MSBuild on our new build server for an ASP.Net MVC 5 C# project using.Net v4.5 but get the following exception, I can't find any resources on it though.

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

Turning on verbosity for MSBuild I get the following.

[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.

After trawling through various articles, sites and forums I still haven't found a definitive answer. However it led me to install .Net Framework Version 3.5 on our build server (which includes .Net version 2.0) and it has altered the exception to a more general asp_net merge one. However I don't really get sufficient information to work out what is wrong, I still feel this is linked to my original problem.

[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.

Upvotes: 1

Views: 2050

Answers (2)

Amit Mitra
Amit Mitra

Reputation: 83

Just an addition to what has been already answered.

Our Case: We installed 4.5.1 sdk on our build server (Ccnet) which was already building v4.0 solutions and stopped after the sdk installation.

Solution : Changed the path of in "C:\Program Files (x86)\MSBuild\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.targets" to "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64"

Hope it helps.

Upvotes: 1

fungus1487
fungus1487

Reputation: 1809

Turns out after trial and error (a lot of it) that AspNetMerge path was incorrect.

The file at:

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

Has a section which was pointing to:

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

I have since changed the .targets section to look like:

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

Everything builds as planned now.

Upvotes: 1

Related Questions