Jambobond
Jambobond

Reputation: 619

Assembly becoming 32bit specific when built in release rather than debug in VS2008

I am having a strange issue when building assembly's for one of my modules.

I was getting errors when running on 64bit which I traced back to being related to the assembly being 32bit specific. Our modules are(or should) all be built to be bit agnostic.

Running CorFlags.exe on the assembly showed the following.


Version : v2.0.50727

CLR Header: 2.5

PE : PE32

CorFlags : 11

ILONLY : 1

32BIT : 1 <-- Note the 32bit flag set to one!

Signed : 1


However I then went back to rebuild the module and just so happened to build in debug mode. (Note: this is the simplified version of the story missing out the hours of solution testing, googling and a fight with a dragon :D)

This time when I checked CorFlags.exe it gave the following:


Version : v2.0.50727

CLR Header: 2.5

PE : PE32

CorFlags : 9

ILONLY : 1

32BIT : 0

Signed : 1


So now I am confused, having torn apart the visual studio build configs and found them to be exactly the same (i.e. all set to "Any CPU") I am now at a loss as to how to fix this.

What would cause this behaviour?

Upvotes: 0

Views: 113

Answers (2)

Hans Passant
Hans Passant

Reputation: 942090

Build + Configuration Manager, select Release in the upper left combo. Close. Now use Project + Properties, Build tab and verify Platform Target.

Upvotes: 1

Giorgi
Giorgi

Reputation: 30883

I am not sure what's causing this behavior but here is a possible workaround:

Have you tried running CorFlags with /32BIT- flag to clear the 32BIT flag from the assembly? If it work you can add a postbuild step to cleat that flag.

Upvotes: 0

Related Questions