How to update WPF browser application manifest and xbap file with ‘mage.exe’

來源:互聯網
上載者:User

標籤:

老外參考文章1

老外參考文章2

I created a WPF browser application MyApp then published it by ClickOnce in VS2008.

Published folder like this:

PublishedFolder\MyApp.xbap

PublishedFolder\setup.exe

PublishedFolder\Application Files\MyApp_0_0_0_1\ MyApp.xbap

PublishedFolder\Application Files\MyApp_0_0_0_1\ MyApp.exe.manifest

PublishedFolder\Application Files\MyApp_0_0_0_1\ MyApp.exe.deploy

PublishedFolder\Application Files\MyApp_0_0_0_1\otherDependedLib.dll.deploy

Now, I usually need to modify app.config because I need modify DB connection string and services addresses etc. But after published to application server, I don’t want to republish the version with VS2008. So I find mage.exe tool.

I put mage.exe and MyApp.pfx in “PublishedFolder\”

Then I do like so:

mage -Update "Application Files\MyApp_0_0_0_1\ MyApp.exe.manifest"

mage -Sign    "Application Files\MyApp_0_0_0_1\ MyApp.exe.manifest" -CertFile MyApp.pfx -Password "test"

mage -Update MyApp.xbap -appm "Application Files\MyApp_0_0_0_1\ MyApp.exe.manifest"

mage -Sign     MyApp.xbap -CertFile MyApp.pfx -Password "test"

When I run update manifest command, I got "Error MSB3113: Could not find file "otherDependedLib.dll"... ".

My dependent dlls all added ".deploy" for client download.

But update success and I found hash value and sign name value had been changed in MyApp.exe.manifest and MyApp.xbap.

Then I browser the application in IE after cleaned buffer with “mage -cc”.

But I get next error:

ERROR SUMMARY

Below is a summary of the errors, details of these errors are listed later in the log.

* An exception occurred while downloading the manifest. Following failure messages were detected:

                + Downloading http://localhost/MyApp.exe.manifest did not succeed.

                + The remote server returned an error: (404) Not Found.

 

Maybe I did some wrong options in mage step, who can tell me the correct method. Thank you!

use a script to remove .deploy first then sign the add it back before signing the xbap

rename *.deploy *.

以上是一個老外在利用指令碼發布XBAP中重簽名的方法,結合紅字部分可以解決問題,經過多方搜尋和分析及實驗,以下指令碼可以完成自動發布並線上安裝成功:

@echo 編譯XBAP相關@echo 清理APP緩衝"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe" -cc @cd App\BrowserOfHmiRMDIR /s /q "bin\Debug"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe BrowserOfHmi.csproj /target:publish /t:Build /property:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=BrowserOfHmi.log@echo Close notepad to continue...@if errorlevel 1 @notepad  BrowserOfHmi.logcd..cd..@echo 清理舊發布檔案RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\"md "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\"@echo 拷貝發布檔案xcopy "App\BrowserOfHmi\bin\debug\*.dll" "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\" /s /h /y /d:1-1-1999xcopy "App\BrowserOfHmi\bin\debug\*.exe" "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\" /s /h /y /d:1-1-1999xcopy "App\BrowserOfHmi\bin\debug\*.manifest" "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\" /s /h /y /d:1-1-1999xcopy "App\BrowserOfHmi\bin\debug\*.xbap" "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\" /s /h /y /d:1-1-1999xcopy "App\BrowserOfHmi\icon\*.*" "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\icon\" /s /h /y /d:1-1-1999RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\app.publish\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\de\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\en\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\es\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\fr\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\it\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\ja\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\ko\"RMDIR /s /q "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\zh-Hant\"@echo 重新簽名"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe" -Update "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.exe.manifest""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe" -Sign    "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.exe.manifest" -CertFile "App\BrowserOfHmi\BrowserOfHmi.pfx" -Password "action98""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe" -Update "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.xbap" -appc "Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.exe.manifest" -appm "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.exe.manifest""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe" -Sign     "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.xbap" -CertFile "App\BrowserOfHmi\BrowserOfHmi.pfx" -Password "action98"@echo 增加.deployren "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\*.dll" "*.dll.deploy"ren "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\zh-Hans\*.dll" "*.dll.deploy"ren "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\*.exe" "*.exe.deploy"ren "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\icon\*.ico" "*.ico.deploy"@echo 拷貝xbapcopy "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\BrowserOfHmi.xbap" "..\Build\Install\Packages\Browser\Xbap\BrowserOfHmi.xbap"  /Ypause

上面的去掉.deploy我暫時沒用,如果用了可以節省一些代碼,讀者可以自己實驗下。

How to update WPF browser application manifest and xbap file with ‘mage.exe’

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.