1

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

Zeller33
  • 181
  • 2
  • 4
  • 16

1 Answers1

2

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.

Community
  • 1
  • 1
Zeller33
  • 181
  • 2
  • 4
  • 16
  • I regret a bit showing how to do it both ways. You *either* use vsdevcmd.bat *or* you use the full path. Given that these path names turned out not to be stable at all, you really do favor the vsdevcmd. – Hans Passant Apr 08 '18 at 11:04
  • still works like a charm in VS19, however the location for vsdevcmd.bat is different in VS19 – Sumit Cornelius Nov 03 '22 at 16:24