问题
I need to compile my C# application with high entropy VA turned off due to a vendor library incompatibility. The only way I've found to do it so far is a post-build step with editbin, but that's quite clunky. Is there a better way?
回答1:
The IDE is missing support for this option in the Build property sheet. But that's easy to work around, you can simply add the property to the .csproj file by hand. Open it in a text editor, Notepad is fine. Locate the <FileAlignment> property and add after it:
<HighEntropyVA>False</HighEntropyVA>
And rebuild the project. You can verify by running dumpbin.exe /headers on the generated executable file:
...
8540 DLL characteristics
Dynamic base
NX compatible
No structured exception handler
Terminal Server Aware
And note the missing "High Entropy Virtual Addresses" characteristic.
来源:https://stackoverflow.com/questions/27570858/passing-highentropyva-to-csc-compiler-from-msbuild-command-line-or-project-fil