MSBuild: Aspnet_merge.exe Exited With Code 1

MSBuild: Aspnet_merge.exe Exited With Code 1

This error pops up when compiling ASP .Net 2.0 Web Deployment projects. One common scenario is when you try to compile with option "Merge into single assembly"

Solution 1:

Do not use Merge into Single Assembly. Use "Create a seperate assembly for each page and control output". 




Solution 2:

Typically the problem is that when aspnet_merge trying to merge find naming collisions. By default, asp.net 2005 web site applications do not put a default namespace in the class files so if you create MyPage.aspx in the root and also in a sub-folder, this would causes a conflict when merged into a single assembly for the Release build.  This problem would not manifest itself during development because you're not pre-compiling the entire web site into a single DLL so there are several DLLs that make up the web project and naming collisions are avoided.  To fix the problem you can obviously either rename one of the classes or provide a namespace to avoid the conflict.

Your first step is to find the classes that are causing problems.

To do that: 

1. Click on Tools menu

2. Click on Options

3. Expand "Projects and Solutions"

4. Click on Build and Run 

5. Slect "Diagnostic" from "MSBuild project build output verbosity"

  


Now build the Web Deployment Project with Single Assembly option. This should fail. Expand the build to see the error.

 




Look for the part "Duplicate type xxxxx found..."

Search on entire solution/project for the type you found.

Keep only one and rename the rest to something else.  Don't forget to change the reference on corresponding aspx files.

Build again. Hopefully the above solution should solve the problem unless there is more collision. Repeat the process for more collisions. 

Currently rated 5.0 by 7 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Manik
Posted on: 10/3/2007 at 2:41 PM
Tags:
Categories: Programming / Coding
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Comments are closed