Wednesday, February 14, 2007

Issue - "aspnet_merge.exe" exited with code 1.*

Wednesday, February 14, 2007 9:57:59 PM (GMT Standard Time, UTC+00:00)

A while ago I blogged about the tool used to deploy web sites in VS 2005 i.e. VS 2005 Web Deployment Projects. Well now I'm back on that trail as I've found a little hole that people keep slipping into, which I myself was a victim of.

Now, the problem came about as I was trying to build a deployment web project and I was prompted with the following message in the Output mini-tab.

Target AspNetMerge:
Running aspnet_merge.exe ...
C:\...\WebDeployment\v8.0\aspnet_merge.exe "J:\...\Visual Studio 2005\Projects\test\test_deploy\Release" -prefix ss -copyattrs
C:\...\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(574,9): error MSB6006: "aspnet_merge.exe" exited with code 1.
Done building target "AspNetMerge" in project "test_deploy.wdproj" -- FAILED.

Done building project "test_deploy.wdproj" -- FAILED.

Build FAILED. (<-in a nutshell)

After checking the net for a while I found many forums and blogs with this error documented... The most common reported cause of this problem was the presence of duplicate classes within the project.

One solution suggested by a dude in ASP.NET forums was to "pick the option "Create a separate assembly for each page and control output" in the Web Deployment project property under Output Assemblies." (Ref). ... This works well however I just didn't like having each file/page with its own .DLL, seems a bit much for me (even though updating pages would be quite easier).

Another solution which really is the only RIGHT solution .. "hey, if there are duplicate class names, why not just rename the classes!". This is really a no-brainer.. however, what if VS doesn't tell you which classes are duplicated? This is what happened to me! Even though I followed this guy's advice and switched MSBuild output verbosity to Diagnostic.

I then tried using Diagnostic, Normal, but nothing would tell me what class names were duplicated! So I had to go through one by one to find the duplicate.

Lesson of the story? DO NOT COPY Pages or Classes without renaming them IMMEDIATELY! (This is what lead to my duplicate classes - copying pages for reuse.)

Related posts:
Select a random row in MS SQL...
Regular expressions
VS2005, ASP.NET 2 & DLLs, DLLs..
MS's ASP.NET and.. PHP
2-way databinding cascading drop down lists within a FormView
ApplicationName Property when customising providers

Comments are closed.