Ziff Davis EnterpriseDevLife
Advertisement
Advertisement

Monday, July 20, 2009 12:58 PM/EST

VS2010 Beta 1 - Beware default Build Targets

One of the new features of VS2010 Beta 1 that I have been exploring is the 1-Click Deployment which I mentioned in another blog post last month. (Visual Studio's Database Publishing Wizard and the new 1-Click Web Deployment)

My test Web App solution contained a Web Application project and a class library project. I set up a test publishing account with Orcsweb (you can too at http://bit.ly/1489Nm). After I published my application and verified that database had been published as well as all of the necessary files for the web application, I was unable to run the app.

I received an error telling me that there was a problem with my class library:

Could not load file or assembly 'EFModelforOneClickWebApp' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Yet I knew that file was there and the only thing it depended on was a .Net assembly, System.Data.Entity.

Searching on that error I found this great blog post by Chris Crowe that suggested a processor conflict.

It turns out that indeed, the host server was 64 bit. But I had not targetted X86, so what was the problem?

I checked the Platform target of the web app project and it was set to "Any CPU". But my class library was set to "X86". I changed the class library to Any CPU, rebuilt, republished and voila everything worked.

But why was the default of the class library X86? After finding a submission for this problem on the MSDN Connect website, I learned that this was actually an experiment for Beta 1.

Some project types default to Any CPU whlie others default to X86. This is not what any experienced Visual STudio user would expect since the default has always been Any CPU.

According to the connect item,we'll get the normal default back with Beta 2, at least for class libraries. But the client side apps (WinForms, WPF others) may still default to x86.

Given the feedback we've heard so far, it's worth mentioning that we're planning on changing the default target for Class Libraries to be AnyCPU for Beta2 so that libraries can be consumed in both 32-bit and 64-bit processes without any change.

Glad to hear it but I wish it hadn't cost me three hours!

TrackBack

TrackBack

http://blogs.devsource.com/cgi-bin/mte/mt-tb.cgi/17476

Comments (1)

The problem isn't the experiment or anything like that -- the problem is the awful and useless error message! Had a more specific and actionable error been given, the experiment would not have been a time waster for anyone!

Post a Comment

 
 

Advertisement

Syndication

Subscribe: