views:

289

answers:

2

.NET 3.5 Visual Studio 2008 Team Edition

I have an XML file that I've added to an assembly via the Resources tab of the project's properties; and have marked the Access Modifier as public. While running in debug mode, there are no problems referencing the assembly and the embedded resource in another project, i.e.,

XElement errorMap = XElement.Parse( Properties.Resources.ErrorMapper );

However, when the projects are run in Release mode, I receive this error:

Could not load file or assembly 'XXX.XXX, Version=1.1.0.25104, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Why would the projects run fine in Debug mode but not Release mode?

A: 

Hmmm....

I run a 64 bit dev machine and had targeted the build and release modes to the x86 platform. Apparently, when I added the resource file the platform build for release mode changed to Any CPU.

Since I reference some 3rd party DLL's that require 32 bit, the Any CPU build on Release mode puked out.

Problem solved.

Metro Smurf
A: 

Are you referencing a .dll file on your test box that is not in the same location on your production one? I guess that depends on whether you have your references set to copy local...

What about your .net frameworks and service packs, I would make sure those are the same/up to date...

J.13.L
Not in the case. See my resolution:http://stackoverflow.com/questions/723055/accessing-an-xml-embeded-resource-file-throws-error-in-release-mode-but-not-debug/723253#723253Anyhow, in this case, the question was about running locally in debug/release; not test/prod environments.
Metro Smurf