Turning DEP off in Visual Studio 2010 for non-DEP controls

We recently needed to update one of our in-house applications that used Mappoint 2006 control within it.

We had started using Visual Studio 2010 – it would build but we could not install it on Windows 7.

The problem was that VS2010 expects all applications to be DEP (Data Execution Prevention) compatible and Mappoint 2006 is not DEP compatible. So although it built it ok the resulting executable would not install on DEP aware operating systems.

We were already committed to VS2010 and could not go back to older versions. We could have upgraded to the latest Mappoint (2010) but that was ruled out due to licensing costs.

In the end we found we had to add some commands to the post build events of the project that turned off DEP for the built executable:

call “$(DevEnvDir)..toolsvsvars32.bat”

editbin.exe /NXCOMPAT:NO “$(ProjectDir)binrelease$(TargetFileName)”

editbin.exe /NXCOMPAT:NO “$(ProjectDir)objrelease$(TargetFileName)”

We found this worked on VS2010 on an XP machine but we had problems with other Win7 based machines. Not sure why!?

Author: James

IT Manager - Network, Web coding, MS SQL and Online Mapping expert

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: