Passing /highentropyva- to CSC compiler from MSBuild command-line or project file

可紊 提交于 2020-02-20 06:16:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!