Fizz Fizz - 3 months ago 21
C# Question

Strong Name validation fails after enabling LARGEADDRESSAWARE

I am building n C# executable that has to be built as a 32-bit application (due to other environment restrictions). As a post build step I'm using

to allow the 32-bit application to utilize more than 2GB of memory; although I noticed that this is breaking Strong Name validation.

Before running the
command I run
sn.exe -vf
to verify the Strong Name:

sn.exe -vf [my exe]

The output:
Assembly '[my exe]' is valid

Then I run
editbin.exe /LARGEADDRESSAWARE [my exe]' which just exits without any message. I verify that it's enabled to use more than 2GB by checking the headers via
dumpbin /headers [my exe]`.

Finally, I rerun the
command and get the following output:

Failed to verify assembly -- Strong name validation failed for assembly '[my exe]'

Any ideas how I can enable LARGEADDRESSAWARE functionality without breaking the Strong Name verification?


A strong name takes into account the hash of the file being strong named; by altering the file with editbin.exe \LARGEADDRESSAWARE, you're altering the file, therefore the hash of the file, and thus invalidating the strong name.

You need to alter your build steps, and ensure that the assembly is exactly as you want it before running the strong name step. Depending on your build pipeline, this may mean not strong naming it within Visual Studio, and instead using the command line to do so instead.