Home » Programming / Coding

MSBuild: Aspnet_merge.exe Exited With Code 1

3 October 2007 778 views No Comment

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

msbuild

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”

msbuild2

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

msbuild3

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.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.