从 MSBuild 命令行或项目文件将/highentropyva- 传递给 CSC 编译器 [英] Passing /highentropyva- to CSC compiler from MSBuild command-line or project file

查看:18
本文介绍了从 MSBuild 命令行或项目文件将/highentropyva- 传递给 CSC 编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于供应商库不兼容,我需要在关闭高熵 VA 的情况下编译我的 C# 应用程序.到目前为止,我发现的唯一方法是使用 editbin 进行后期构建步骤,但这很笨拙.有没有更好的办法?

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?

推荐答案

IDE 在 Build 属性表中缺少对这个选项的支持.但这很容易解决,您只需手动将属性添加到 .csproj 文件即可.用文本编辑器打开,记事本就好了.找到 属性并在其后添加:

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>

并重建项目.您可以通过在生成的可执行文件上运行 dumpbin.exe/headers 来验证:

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.

这篇关于从 MSBuild 命令行或项目文件将/highentropyva- 传递给 CSC 编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆