LargeAddressAware Visual Studio 2015 C#

23.7k Views Asked by At

So today I decided I would update to Visual Studio 2015 (previously running the RC version with no difficulties) but now my project does not like the /LARGEADDRESSAWARE command line event.

I have a post-build event of:

call "$(DevEnvDir)..\tools\vsvars32.bat"
editbin /largeaddressaware "$(TargetPath)"

However I get the following error:

The command "call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE..\tools\vsvars32.bat" editbin /largeaddressaware "C:\...\bin\Debug\Application.exe"" exited with code 9009

Any thoughts?

4

There are 4 best solutions below

0
On BEST ANSWER

The issue was caused when uninstalling the Visual Studio 2015 RC version. It does not remove all the directories and therefore the install of the full release version is not successful. The simple solution is to uninstall the RC version and restart. Then manually delete the C:\Program Files (x86)\Microsoft Visual Studio 14.0 directory. Then you can install the the new version without any issues.

Credit Hans Passant for identifying this issue.

0
On

My problem with this, that I was calling vcvarsall.bat from the wrong location first. I'd upgraded to Visual Studio 2017, and vcvarsall.bat had moved. (So had EditBin.exe. There are 4 locations for it now, though I changed to using whatever was in the path.) Fixing that, fixed the problem. Here's my post-build file for your purview.

:: Install C++ tools to have these installed

:: build for 32 bit     
:: VS 2012 call "$(DevEnvDir)..\..\vc\vcvarsall.bat" x86 

:: build for 64
:: VS 2012 call "$(DevEnvDir)..\..\vc\vcvarsall.bat" amd64
:: VS 2017
call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsall.bat" amd64

:: "$(DevEnvDir)..\..\vc\bin\EditBin.exe" "$(TargetPath)"  /LARGEADDRESSAWARE
EditBin "$(TargetPath)"  /LARGEADDRESSAWARE
5
On

I call a cmd script as a PostBuildEvent:

IF  EXIST  "%VS140COMNTOOLS%"  CALL  "%VS140COMNTOOLS%vsvars32.bat"
IF  EXIST  "%VS120COMNTOOLS%"  CALL  "%VS120COMNTOOLS%vsvars32.bat"
IF  EXIST  "%VS110COMNTOOLS%"  CALL  "%VS110COMNTOOLS%vsvars32.bat"
IF  EXIST  "%VS100COMNTOOLS%"  CALL  "%VS100COMNTOOLS%vsvars32.bat"

editbin.exe /LARGEADDRESSAWARE MyApp.exe

It checks for the environment variable according to the installed VS (first 2015, next 2013, next 2012 and finally 2010) and now all paths are fine.

If it still can't find the .exe, make sure the C++ Tools option in the installer is selected. By default VS2015 only installs C# and VB.net, but not C++ with its tools. Here you have to activate it under custom in the setup:

enter image description here

0
On

If you set your platform to "Any CPU" this flag is set for you by default now in Visual Studio 2015.

See Compiling C# with Any CPU sets Application can handle large (>2GB) addresses.