views:

104

answers:

1

Hi,

I've been wrestling with this for a while now. I have an app that uses a lot of mem and really would benefit from being LargeAddressAware.

Problem in short: With the LAA-flag, the app won't start.

Empirical results:

1) I have a release script that runs the entire ClickOnce publishing, then re-signs the executables and dlls, then re-creates the manifest, signs it etc

2) Running the script gives me an app that installs and works nicely

3) Adding this to the post-build breaks the app:

editbin /LARGEADDRESSAWARE <path>/obj/Publish/app.exe

(yes, I know, we have a build config that's called Publish - idiotic - but works...)

The error message I get is:

Activation of \betabox\appbeta\app.application resulted in exception. Following failure messages were detected:

+ Strong name signature not valid for this assembly app.exe.

Both my the manifest and the exe is signed by a valid code signing cert. And the script works fine when the flag does not get set.

I've tried without my script as well, with just the editbin command in the post-build and publishing through VS - same error.

So - is it totally impossible to publish an app with LARGEADRESSAWARE set through ClickOnce?

Thanks!

+4  A: 

Solved!

Got help from Kira in the ClickOnce forums: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/b008087c-45f8-4de6-b8f5-f34fddb29c8c/?prof=required

Solution: The EXE has to be re-signed with a new strong name after the LAA flag has been set.

How to do this: In the post-build, the flag is set by:

cd $(ProjectDir)
editbin /LARGEADDRESSAWARE obj/$(ConfigurationName)/app.exe

And after that, also in the post-build, the exe has to be re-signed:

sn -Ra obj\$(ConfigurationName)\app.exe PublicPrivateKeyFile.snk

This is of course assuming that the PublicPrivateKeyFile.snk is a code signing key and in the path of the Visual Studio project.

My problem was that I was re-signing all dlls/exes after the build using:

for /R %BIN_DIR% %%f in (*.dll) do signtool sign /a /i "Thawte" /t http://timestamp.verisign.com/scripts/timstamp.dll "%%f"
for /R %BIN_DIR% %%f in (*.exe) do signtool sign /a /i "Thawte" /t http://timestamp.verisign.com/scripts/timstamp.dll "%%f"

But this does not update the strong name, just signs the exe as it is.

Hope this helps someone!

andyhammar