I am trying to execute the following command in the Post-Build event:

"$(DevEnvDir)..\..\vc\bin\EditBin.exe" "$(TargetPath)" /LARGEADDRESSAWARE , but I catch error code 3.

Worth Visual Studio 2017.

Or this thing is not needed at all, if I collect under Any Cpu?

Simply, the solution in TFS in this form lay.

  • It seems, Large Address Aware is set by a checkbox in the project properties ... - VladD
  • one
    I have the file C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\editbin.exe there, it just coincides with what you have written. - VladD
  • @VladD, Something I do not have on this path. Maybe something needs to be delivered? What does this directive give? By building an application for x32, will it be able to use an address space above 2GB? - iluxa1810
  • one
    Yes, there is a suspicion that when using the new Studio versions of the AnyCPU Prefer 32bit application, LARGEADDRESSAWARE are automatically LARGEADDRESSAWARE ( social.msdn.microsoft.com/Forums/windowsapps/en-US/... ) MSDN.WhiteKnight
  • @ MSDN.WhiteKnight: Why not as an answer? This essentially solves the TC problem. - VladD

3 answers 3

A similar question was asked in English Stack Overflow: vsvars32.bat in Visual Studio 2017 .

In Visual Studio 2017, not only the standard path by which devenv.exe could always be found ( "C: \ Program Files (x86) \ Microsoft Visual Studio% version% \ Common7 \ IDE" ) was changed , but also the path to utilities .

In particular, the path to the editbin.exe utility will be something like this: "C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Professional \ VC \ Tools \ MSVC \ 14.14.26428 \ bin \ Hostx86 \ x64 \ editbin.exe " . In this way there are several variables that will differ depending on the version and edition of Visual Studio: 2017 , Professional , and 14.14.26428 . In addition, the Hostx86 and x64 folders can also be replaced with Hostx64 and x86 , respectively.

Thus, the Post-build event command can be like this: $ (DevEnvDir) .... \ vc \ Tools \ MSVC \ 14.14.26428 \ bin \ Hostx86 \ x86 \ editbin.exe "" $ (TargetPath) "/ LARGEADDRESSAWARE

Perhaps there should be special macros or environment variables that allow you to specify the correct path without delving into the value of the variables, but I did not find similar paths among the macros, as well as among the variables that the SET command displays.

    In addition to the answer @Uranus, I have the necessary file found here:

     "$(VC_ExecutablePath_x86)\editbin.exe" 

    However, this variable is available when building C ++ projects, but not C #.

    • If it's not a secret, but what does LARGEADDRESSAWARE give at all? Type being compiled under X32, can it work with X64 address space? Or is this parameter generally superfluous and equal to AnyCpu? - iluxa1810
    • one
      @ iluxa1810: Here's a little on the topic: blogs.msdn.microsoft.com/oldnewthing/20040812-00/?p=38183 . It says that in a program, address arithmetic does not come from the implicit assumption that all pointers are of the same character. This is significant only for 32-bit programs that run under Windows, which is launched with the /3GB key (that is, in which the address space between the user interface and the kernel is not divided as 2GB / 2GB, but as 3GB / 1GB). - VladD
    • one
      @ iluxa1810: And this allows Windows to give the program 3 GB of address space, not 2. - VladD

    Starting in Visual Studio 2015, applications built in the "AnyCPU Prefer 32bit" mode are automatically LARGEADDRESSAWARE, so there is no need to add this parameter using editbin. This change is not documented, but is mentioned in many places on the forums, for example here .

    For reference, marking the exe file LARGEADDRESSAWARE gives:

    • On a 32-bit OS with no boot option set / 3GB - zero effect

    • On a 32-bit OS with the boot parameter set to / 3GB - an increase in the maximum address space from 2 GB to 3 GB

    • On 64-bit OS - increase the maximum address space from 2 GB to 4 GB