21

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?

8
  • Separate each command with ; and try again. Commented Jul 22, 2015 at 14:09
  • Unfortunately that was the first thing I tried, it doesn't make much sense that this has had to change when it work in the 2015 RC version perfectly fine... And the two location directories are correctly, I manually checked both and both files exist where they are supposed to be :(
    – Rolodium
    Commented Jul 22, 2015 at 14:11
  • to me it looks like its running the whole post build event as one command Commented Jul 22, 2015 at 14:59
  • 1
    Output windows gives the following error "'editbin' is not recognized as an internal or external command, operable program or batch file."
    – Rolodium
    Commented Jul 22, 2015 at 15:17
  • 5
    It is located in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\editbin.exe Use Explorer to see if it is there. That directory has 45 files, if it is substantially empty then the VS2015 install did not go well. Usually caused by not properly uninstalling a CTP or RC version. Commented Jul 22, 2015 at 16:14

4 Answers 4

50

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

5
  • 6
    Thanks a ton, that was exactly the issue I had ! Had not installed the C++ Tools ...
    – SvenG
    Commented Sep 9, 2015 at 11:51
  • This is what worked for me, however I also noticed an existing postbuild command I had from a migrated VS2013 project had special quote characters which had apparently worked before. Changing these to neutral quotes worked. Commented Sep 13, 2016 at 14:27
  • If I'd already have c++ and f# installed, how could I uninstall them? Is that even possible?
    – eddy
    Commented Sep 18, 2016 at 17:50
  • @eddy in this dialog, uncheck the entries ;) Commented Sep 18, 2016 at 17:53
  • 2
    This is a correct solution. You actually only need to install the "Common Tools...", saves a few GB of install.
    – Hersker
    Commented Jan 3, 2017 at 8:51
8

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.

3

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.

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.