LargeAddressAware icon indicating copy to clipboard operation
LargeAddressAware copied to clipboard

Publish app removes LargeAdressAware

Open RomanPetlitsky opened this issue 1 year ago • 7 comments

We are publishing with command dotnet publish "path" --no-restore --no-build --no-self-contained After publishing the LargeAdressAware disappears. As a workaround I am thinking about copying my *.exe from Release to Publish folder. It looks like impossible to use the package with publish command.

RomanPetlitsky avatar Sep 17 '24 14:09 RomanPetlitsky

Try using https://msbuildlog.com and pass -bl to your dotnet publish and then inspect the binlog to understand what's happening. You can search for the exe name and see which targets copy it or rewrite it.

For your .exe, what is the TargetFramework? What is the PlatformTarget? Does it have to be 32-bit? When you run corflags my.exe, what does it print?

KirillOsenkov avatar Sep 17 '24 17:09 KirillOsenkov

Thanks for your time. It looks like dotnet publish "path" --bl doesn't produce any logs while with dotnet build it works. coflags doesn't work well on mychine but I used dotPeek to check headers: Just after build: image

After publishing with --no-build option: image

The flag disappeared. The same happens in Pipeline when we are about to create installer and doing publishing after build.

image

I also tried "AfterPublish" instead of "AfterBuild" and it didn't help

RomanPetlitsky avatar Sep 18 '24 09:09 RomanPetlitsky

what's in your .csproj file? are you setting PlatfromTarget x86?

Try setting PlatfromTarget AnyCpu and then set Prefer32Bit to true in .csproj. Then you get 4GB of address space and you don't need LargeAddressAware at all.

KirillOsenkov avatar Sep 18 '24 16:09 KirillOsenkov

you can also use dumpbin /headers on your binary. Strange that corflags doesn't work

KirillOsenkov avatar Sep 18 '24 16:09 KirillOsenkov

also you should use -bl not --bl

focus on getting the binlog from publish, then you will know who overwrites your exe and why

KirillOsenkov avatar Sep 18 '24 16:09 KirillOsenkov

what is the exact file size of your exe?

KirillOsenkov avatar Sep 18 '24 16:09 KirillOsenkov

Thanks Kirill,

Logs helped me to understand that Publish for WPF copies intermediate assembly obj/apphost.exe instead of Release/appname.exe.

RomanPetlitsky avatar Sep 20 '24 07:09 RomanPetlitsky