Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set LARGEADDRESSAWARE from within Visual Studio?

I have a .NET assembly that needs to be 32-Bit and needs to be /LARGEADDRESSAWARE.

I know how to do this with EditBin, but I wonder if there is a built-in way in Visual Studio 2010? Or alternatively, did someone write an MSBuild Task for this?

Edit: This is for a C# app, so no linker options sadly :(

like image 763
Michael Stum Avatar asked Apr 08 '10 05:04

Michael Stum


People also ask

What is Largeaddressaware?

Large Address Aware (LAA) is a technique available in 64-bit Windows operating systems to allow 32-bit programs use all 4Gb (typically 2Gb user + 2Gb system space) of its potential memory space, rather than be limited by the default (typically 2Gb, but sometimes 3Gb if using special techniques).


2 Answers

Building on @RouMao's answer, you may get an error message saying that editbin cannot be found. Ensure that the environment in the post-build event command line is setup properly by specifying as follows:

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

Another thing to understand is that your LARGEADDRESSAWARE enabled application will not run in debugging mode when (under the Debug tab in your project properties) the Enable the Visual Studio hosting process check-box is checked (which it is by default), because the vshost.exe is not properly flagged.

Uncheck that box to debug your application using LARGEADDRESSAWARE.

like image 67
Michael Avatar answered Sep 21 '22 04:09

Michael


You can do it as a Post-build task. In "Build Events" tab, put following command

editbin /largeaddressaware $(TargetPath) 

into the "Post-build event command line:"

This is the case for VS2008. I think it should work in the same way for VS2010.

like image 35
Yi Zhao Avatar answered Sep 19 '22 04:09

Yi Zhao