Zeller33
Zeller33

Reputation: 191

C# VS 2017 - disable DEP feature during build

As the title says, how do I disable the DEP feature for a specific C# project rather than the whole of the OS? I use Visual Studio 2017

I need to use an old ActiveX Dll within the project, which requires this feature disable otherwise it will throw errors at runtime.

Note I have looked everywhere and followed every google search. My properties/options don't seem to match whats said on the internet (maybe because I'm using VS 2017??)

Thanks

Upvotes: 1

Views: 1510

Answers (1)

Zeller33
Zeller33

Reputation: 191

Okay so I fixed it thanks to everyone's help:

  1. Make sure to install VC++ 2017 v141-Toolset (x86,x64)

  2. Add the following to the Post-Build event:

call "$(DevEnvDir)..\tools\vsdevcmd.bat"

"$(DevEnvDir)....\VC\Tools\MSVC\14.13.26128\bin\Hostx86\x86\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"

There must be a newline between ...vsdevcmd.bat" and "$(DevEnvDir... Also the toolset version may change (14.13.26128) so adjust where necessary.

Upvotes: 2

Related Questions