How to set LARGEADRESSAWARE in no signing assembly projects for a ClickOnce app?

折月煮酒 提交于 2019-12-10 17:50:15

问题


I have an application with the next two Post-Compilation commands:

call editbin /LARGEADDRESSAWARE $(TargetPath)
call editbin /LARGEADDRESSAWARE $(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\$(TargetFileName)

and works fine.

But when I publish into a server as the ClickOne Application works with no errors but when I try install in a client the hash of file is different than the value calculated in the manifest.

I tryed to use the next command:

sn -Ra $(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\$(TargetFileName) PublicPrivateKeyFile.snk

but does not work and it shows the next message:

app.exe does not represent any strong-named assembly.

I suppose it's because all my projects has the "signing the assembly" option with false value. Before using LARGEADDRESSAWARE the ClickOnce Application worked fine.

It is necesary to set the "signing the assembly" option with true value for all projects or are there any way to use LARGEADDRESSAWARE with false value for this option?

EDIT:

Solution of Mark Sowul works fine: Also I added in AfterBuild the next lines in order to check if the AfterCompile works fine

call "$(VS110COMNTOOLS)vsvars32.bat"
dumpbin /headers "$(TargetPath)" > "$(TargetPath).info"
findstr "(>2GB)" "$(TargetPath).info"
set BUID_ERRORLEVEL=%ERRORLEVEL%
del "$(TargetPath).info"
if [%BUID_ERRORLEVEL%]==[0] echo EXE program updated to use more than 2GB
if [%BUID_ERRORLEVEL%]==[1] echo ERROR: EXE PROGRAM WAS NOT UPDATED TO USE MORE THAN 2GB
set ERRORLEVEL=%BUID_ERRORLEVEL%

回答1:


Post Build events are too late in the game. You have found this out to an extent, as I did, by realizing you need to alter the file in obj.

However, Post Build occurs after the manifest generation. So editing the obj file there is too late. The better place to do it is in the AfterCompile build target.

You'll have to edit the csproj; add after the lines you'll already see for this:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
    **<Target Name="AfterCompile">
        <Exec Command="
call &quot;$(VS110COMNTOOLS)\vsvars32.bat&quot;
editbin /largeaddressaware &quot;$(IntermediateOutputPath)$(TargetFileName)&quot;
" />
    </Target>**


来源:https://stackoverflow.com/questions/19692129/how-to-set-largeadressaware-in-no-signing-assembly-projects-for-a-clickonce-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!