Three Is It

Because two isn't enough and four is just too many

Only a free and unrestrained press can effectively expose deception in government.
Hugo Black, Supreme Court Justice
Home Blogs Genealogy Brad's Bookshelf Subscriptions Contact Sign in
 

About the author

Brad Butts is a .NET developer and architect. He is married with children and enjoys reading, working out, and genealogy is his five minutes of spare time.
E-mail me Send mail
National Debt Clock

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

aspnet_merge.exe exited with code 1

Pretty descriptive error code, eh?  Well, I was going to put together an example of what aspnet_merge.exe can do, so the first thing I wanted to do was grab an example application, particularly one that makes use app_code files.  I decided to use the code from BlogEngine.NET.

Yes...I know, I know...the BlogEngine.NET code was never designed to live under a WAP-type model, but surely it can live under that model, right?  Well, uh, not without difficulty.

Step 1: Run aspnet_merge and see what happens
So, I used the Visual Studio 2005 Web Deployment Projects to construct a WDPROJ--an MSBuild project with sweet tasks to run the aspnet_merge utility.  (Note: as far as I can tell, BlogEngine.NET is still a Visual Studio 2005 solution)

At the command line, I typed: msbuild BlogEngine.web_deploy.wdproj



The build started and 54 seconds later...blam!  error MSB6006: "aspnet_merge.exe" exited with code 1.

So, what happened?  Sounds like this error happens when class names collide.  Like so many things, the Web Site project tends to let you get away with bad coding practices like using the same class name for a page's code behind in multiple places--so long as the pages are in separate folders.  Aspnet_compiler will compile separate DLLs so there's never the chance that a single assembly will contain two classes of the same name; however, when aspnet_merge tries to merge all the assemblies into one, the class names will clashes and cryptic errors like "error code 1" will get thrown.

Step 2: Figure out where my problems are and fix them
Unfortunately, the default console logging behavior of MSBuild does not tell me where my errors are, so, after consulting with my handy-dandy MSBuild command line reference, I figure I can do something like this to get more detail on where my errors are occuring:

msbuild /nologo /v:diag BlogEngine.web_deploy.wdproj > msbuild.log

Scrolling up from the bottom of my log, I see this error:

An error occurred when merging assemblies: ILMerge.Merge: ERROR!!: Duplicate type 'widgets_LinkList_edit' found in assembly 'App_Web_nbdnprem'.

Ah-ha!  Multiple classes each named widgets_LinkList_edit.  A quick search for that name reveals that, yes, that class name is used for both the edit.ascx code behind of the LinkList and TextBox widgets.  To fix, I'll go to the TextBox's edit.ascx.cs file and change that class name to widgets_TextBox_edit and to the page declaration in the associated ASCX page and update that, as well.

1...2...3...4 error code 1 issues later and it looks like I have a build!  But do I have a good build?

Step 3: Fire up my BE build to see if it works
Seems like the easiest thing to do is to fire up an instance of the ASP.NET Development Server to host my BE build, so I execute this at the command line:

WebDev.WebServer.EXE /port:8080 /path:"D:\MyTests\BE_Test1\BlogEngine.Web_deploy\Debug_test1" /vpath:"/BE_Test1"

And I get...a Parse Error:



It looks like the page is barfing when it tries to load the PostCalendar user control.  Interestingly, the PostList user control loads fine.  I wonder why?

Looking at the default.aspx markup code, I see that the PostList user control is registered at the top of the page, but the Calendar user control is not.  What gives?



Well, it looks like, as Phil Haack once explained, the controls with the "blog" prefix are registered in the web.config.  Didn't know you could do that.  Pretty cool.

<pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true">
<controls>
<add namespace="Controls" tagPrefix="blog"/>
</controls>
</pages>


This doesn't fix my problem, though.  ASP.NET Parse Errors are usually an indication that the CLR can't find the referenced class in the assembly.  Well, I know the PostCalendar class is in my single assembly (.NET Reflector told me that), so maybe the CLR is not able to find the assembly itself.  Maybe I can help.  Let's modify the control registration in the web.config with the assembly attribute:

<pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true">
<controls>
<add namespace="Controls" tagPrefix="blog" assembly="BlogEngine.Web_deploy"/>
</controls>
</pages>


Hey, what do you know?  It worked!  Now, the page loads up just fine.  Note that this last change I made in the web.config in my build folder; if you try to change the original web.config and then run BE from the IDE, you'll get a compiler error.  It seems to me that these kinds of issues can introduce a lot of challenges to development, as you try to account for the fact that the web.config you deploy to a Production server will need to look slightly different than the web.config that you run in your IDE.  I wonder if there are any MSBuild tasks designed to modify the web.config spit out by the build engine?  Scott Guthrie has talked about other important changes that should occur in your web.config before deploying it to Production.  I wonder if anyone has written a MSBuild task to accommodate those changes?

Clicking around in my pre-compiled BE instance, everything seems to work fine; however, I did encounter one show-stopping error that prevents me from doing important administration tasks--like adding a new entry.  At least I know that issue's related to the BE distribution I downloaded, not my build experiment with aspnet_merge.

So, what have I learned?  Doing pre-compilation on complicated Web Site projects can be tricky business--particularly when using aspnet_merge.  I wonder if I should just demo how to migrate a Web Site project to a Web Application project?

 

 

Currently rated 2.0 by 1 people

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

Posted by Brad on Friday, October 24, 2008 1:48 PM
Permalink | Comments (74) | Post RSSRSS comment feed

Related posts

Comments

Busby SEO Test us

Thursday, November 27, 2008 11:31 PM

Busby SEO Test

Thanks for this codes, thanks for sharing this tech code.

vardis gb

Wednesday, December 03, 2008 6:50 AM

vardis

Ty for the code too. That'll come in useful shortly. Nice one!

Busby SEO Test us

Wednesday, December 03, 2008 12:35 PM

Busby SEO Test

Nice tips.. i'll try it yah. Thank you so much

Busby SEO TEST us

Sunday, December 21, 2008 8:45 AM

Busby SEO TEST

I like this tips. thanks

google gphone android tw

Tuesday, December 30, 2008 12:12 AM

google gphone android

thanks with the codes you post, i can use it to my coding

Busby SEO Test us

Sunday, January 18, 2009 9:48 PM

Busby SEO Test

I often find this problem in many blogs..

Busby SEO Test us

Monday, January 19, 2009 11:09 AM

Busby SEO Test

Hi,

Este tipo de correo que contengan realmente apreciada y que puede dar idea y el conocimiento para hacerlo .. gracias por compartir este tipo de correo.

best regards,
busby

busana muslim us

Tuesday, February 10, 2009 11:20 AM

busana muslim

hi your tutorial is very usefull for me. i have the same problem. thank you for sharing the tutorial

Inventory management software ar

Saturday, February 21, 2009 9:25 PM

Inventory management software

Very details step by step on the tutorial. TQ

webcam girls us

Sunday, March 01, 2009 11:12 PM

webcam girls

Trying to access each database.

 Skip to content SearchGo Kampanye Damai Pemilu Indonesia 2009

thank for the tips.

So, i can resolved myproblems...

Urban Net Zone us

Wednesday, March 04, 2009 6:27 AM

Urban Net Zone

now i know what im going to do to my blogs, thanks for the help

mago ar

Tuesday, April 07, 2009 8:44 AM

mago

Thanks for the complete information.

I appreciate it.

Criminal Background Check us

Sunday, April 19, 2009 11:55 PM

Criminal Background Check

Great post! I've bookmarked your blog too because I found it really informative.

Leadership Styles gb

Monday, April 27, 2009 8:25 AM

Leadership Styles

Thanks for writing this great post. Its a nice writing style you use - something I couldn't replicate on my own blog even if I tried! Thanks again.

Electroplating gb

Sunday, May 10, 2009 12:58 PM

Electroplating

Ooo, great post. I'm very impressed. I'll show all my electroplating buddies this post as an example of how I want the content on my electroplating site to look like.

carla us

Friday, May 22, 2009 7:24 AM

carla

Blog engine alone gives me errors sometimes.

tukang nggame

Wednesday, May 27, 2009 6:21 AM

tukang nggame

NIce info thanks

Dating Philadelphia us

Friday, May 29, 2009 11:37 PM

Dating Philadelphia

Thanks for writing this article. It's the best written on I have read all week. Thanks for sharing.

Dating us

Friday, May 29, 2009 11:38 PM

Dating

You are very smart and very thorough. I can tell you know a lot about asp.net programming.

upvc glazing window gb

Friday, June 05, 2009 8:19 AM

upvc glazing window

great work, I like it.

Israel knesset qa

Sunday, June 07, 2009 1:32 PM

Israel knesset

such a great post
made my day
made me love u

Kentucky movers gb

Sunday, June 07, 2009 1:33 PM

Kentucky movers

nice things to do

buying property gb

Tuesday, June 09, 2009 5:18 AM

buying property

Great work I like it so much thanks.

California Orange County Lawyer us

Friday, June 12, 2009 4:33 AM

California Orange County Lawyer



I will share also this information i got in you to my friends so they will know it to..,

Poppers gb

Saturday, June 13, 2009 6:48 AM

Poppers

Thanks for your explanation and illustration.

internet faxes us

Monday, June 15, 2009 5:19 AM

internet faxes

Thanks for sharing your knowledge. I wish you good luck

bodybuilding forum us

Tuesday, June 16, 2009 4:48 PM

bodybuilding forum

hi your tutorial is very usefull for me. i have the same problem. thank you for sharing the tutorial

offshore outsourcing us

Wednesday, June 17, 2009 2:12 AM

offshore outsourcing

I too had a similar problem and was desperately in search for a solution, luckily I got it here.

levirta us

Thursday, June 18, 2009 5:03 PM

levirta

Really a educative and informative post, the post is good in all regards,I am glad to read this post.

kabinet 2009 us

Thursday, June 18, 2009 6:52 PM

kabinet 2009

I understand now about it, and I get it from you.
Thanks.

franchises for sale us

Friday, June 19, 2009 5:34 PM

franchises for sale

hmmmm i'm hungry. Ooops, focus matthew focus matthew focus. Just browsing, thinking of food and browsing. Post some more Smile MunchMunch

Stop Dreaming Start Action us

Saturday, June 20, 2009 2:30 AM

Stop Dreaming Start Action

Nice post, Nice post, Smile thanks for sharing

tukang nggame us

Saturday, June 20, 2009 5:43 PM

tukang nggame

thanks for sharing great post

Sulumits Retsambew us

Tuesday, June 23, 2009 6:24 AM

Sulumits Retsambew

hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.

tukang nggame us

Wednesday, June 24, 2009 9:37 PM

tukang nggame

thanks for your tips

denwai us

Thursday, June 25, 2009 12:39 AM

denwai

ok, well maybe at least a middle range car anyway! (I can't say blogging pays well). Good luck for the future!

cell phone news us

Thursday, June 25, 2009 12:41 AM

cell phone news

thanks for sharing great post

glasgow dentists gb

Thursday, July 02, 2009 8:24 AM

glasgow dentists

Useful application ideas and information for effective results.

Music Love gb

Saturday, July 04, 2009 5:29 AM

Music Love

Nice way of sharing useful stuff and helping ideas.

Music Love gb

Monday, July 06, 2009 12:39 AM

Music Love

Very great ideas and interesting information shared.

live webcam page us

Thursday, July 09, 2009 10:56 PM

live webcam page

kewl aspnet mergexe code

SEO us

Friday, July 10, 2009 4:26 AM

SEO

Nice article.The code works fine and is a good starting point for me making a custom module.Thanks for the module..

dentist kent gb

Saturday, July 18, 2009 4:03 AM

dentist kent

Great article..!! Nice to know about the new things with helping concept.

buy blog reviews us

Monday, July 20, 2009 3:37 AM

buy blog reviews

I really appreciate the kind of topics you post here, that's much as I think and we can apply it to many ways. Thanks for sharing us a great information that is actually helpful. Good day!

kamagra france us

Monday, July 20, 2009 5:16 PM

kamagra france

Interesting way to look at it. For the most part, I agree with you.

sulumits retsambew us

Friday, July 24, 2009 12:58 PM

sulumits retsambew

thanks for this nice info, it's so useful for me.

web marketing us

Wednesday, August 05, 2009 2:29 AM

web marketing

Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work...

tiffany jewelry tr

Friday, August 14, 2009 9:08 AM

tiffany jewelry

I love tiffany jewelry

Heart Graphics

Monday, August 17, 2009 5:28 AM

Heart Graphics

thanks for this usefull informations..
finally i find something that i want to know..
this article is very usefull..

web design us

Tuesday, August 18, 2009 5:42 AM

web design

Thanks for coding. I really appreciate your development in this sphere.

buy blog reviews us

Thursday, August 20, 2009 3:07 AM

buy blog reviews

Thanks for your useful info, I think it’s a good topic. I would like to read more about your articles.

health blog us

Thursday, August 20, 2009 9:46 PM

health blog

nice info. thanks for sharing

promociones del casino en linea in

Saturday, August 22, 2009 8:24 AM

promociones del casino en linea

this last change I made in the web.config in my build folder; if you try to change the original web.config and then run BE from the IDE, you'll get a compiler error. It seems to me that these kinds of issues can introduce a lot of challenges to development, as you try to account for the fact that the web.config you deploy to a Production server will need to look slightly different than the web.config that you run in your IDE.

cheap bridesmaid dresses us

Thursday, August 27, 2009 3:30 AM

cheap bridesmaid dresses

Hey,
waoo that's really interesting info. I would really love to read more about it...

SEO optimisation gb

Thursday, August 27, 2009 3:58 AM

SEO optimisation

Great and interesting, just want to thanks the author for that good contribution !

Stop Dreaming Start Action us

Thursday, August 27, 2009 6:36 AM

Stop Dreaming Start Action

thanks for sharing great article

SEO us

Thursday, August 27, 2009 6:36 AM

SEO

thanks for sharing great coding

Health and Beauty us

Thursday, August 27, 2009 6:37 AM

Health and Beauty

Thanks for coding. I really appreciate your development in this sphere

free poker us

Thursday, August 27, 2009 7:43 AM

free poker

it’s a good topic. I would like to read more about your articles.That contains nice information....
Thanks,

Stop Dreaming Start Action us

Friday, August 28, 2009 8:29 AM

Stop Dreaming Start Action

Thx for sharing nice and useful information

bathroom renovations tips us

Sunday, August 30, 2009 8:31 AM

bathroom renovations tips



Wow, that was heart provoking article presented by you sir
thanks for sharing
regards

Corporate Banking gb

Monday, August 31, 2009 6:47 AM

Corporate Banking

Looking forward for more such stuff. Loved your style of providing the information and the nature of the content.

7 minute muscle review cz

Tuesday, September 01, 2009 7:50 AM

7 minute muscle review

You have a point. Very insightful. A nice different perspective

Fix Windows us

Friday, September 04, 2009 2:33 PM

Fix Windows

We hope that webmasters around the world can use the guide to improve their sites...........

live webcam page us

Monday, September 07, 2009 2:28 PM

live webcam page

Live webcam page is commenting

apex professionals tn

Tuesday, September 08, 2009 9:57 AM

apex professionals

Great article.You idea regarding the new comment system is really good and hope should be liked by all.People are getting bored using the same old comment system, so we are all expecting something new,and hope your idea gets a good response

colon cleansing us

Tuesday, September 08, 2009 3:14 PM

colon cleansing

these tips are very useful and thanks for sharing.

Jitendra Ravia in

Wednesday, September 09, 2009 3:22 AM

Jitendra Ravia

web design India,outsource web development India,wai,W3C design
india,design Ahmedabad,emarketing company india

Jitendra Ravia in

Wednesday, September 09, 2009 3:23 AM

Jitendra Ravia

brahm samaj,brahmin samaj,brahmin community,brahminism

Jitendra Ravia in

Wednesday, September 09, 2009 3:24 AM

Jitendra Ravia

*web hosting india*,Surat,Baroda,Rajkot Offers reseller hosting
India,shared hosting India,dedicated server India,windows
hosting,linux hosting,web hosting Ahmedabad

Jitendra Ravia in

Wednesday, September 09, 2009 3:25 AM

Jitendra Ravia

*gujarati news paper online*,*gujarati news paper bhavnagar* ,*gujarati news paper rajkot*,*gujarati news paper ahmedabad*,*gujarati news paper jamnagar*,*gujarati news paper surat*

Pandemic Planning us

Wednesday, September 09, 2009 12:52 PM

Pandemic Planning

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

Research Papers us

Wednesday, September 09, 2009 1:45 PM

Research Papers

The article is useful for me. I’ll be coming back to your blog.Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this.

Comments are closed