博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to update WPF browser application manifest and xbap file with ‘mage.exe’
阅读量:6288 次
发布时间:2019-06-22

本文共 4598 字,大约阅读时间需要 15 分钟。

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 @echo 编译XBAP项目@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\app.publish\*.*" "..\Build\Install\Packages\Browser\Xbap\" /s /h /y /d:1-1-1999@echo 去掉.deployrename "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\*.deploy" "*."rename "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\Icon\*.deploy" "*."rename "..\Build\Install\Packages\Browser\Xbap\Application Files\BrowserOfHmi_1_0_0_0\zh-Hans\*.deploy" "*."@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\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\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"pause

 

转载地址:http://jakta.baihongyu.com/

你可能感兴趣的文章
使用Swagger2构建强大的RESTful API文档(2)(二十三)
查看>>
Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
查看>>
(转)第三方支付参与者
查看>>
程序员修炼之道读后感2
查看>>
DWR实现服务器向客户端推送消息
查看>>
js中forEach的用法
查看>>
Docker之功能汇总
查看>>
!!a标签和button按钮只允许点击一次,防止重复提交
查看>>
(轉貼) Eclipse + CDT + MinGW 安裝方法 (C/C++) (gcc) (g++) (OS) (Windows)
查看>>
还原数据库
查看>>
作业调度框架 Quartz.NET 2.0 beta 发布
查看>>
mysql性能的检查和调优方法
查看>>
项目管理中的导向性
查看>>
Android WebView 学习
查看>>
(转)从给定的文本中,查找其中最长的重复子字符串的问题
查看>>
HDU 2159
查看>>
spring batch中用到的表
查看>>
资源文件夹res/raw和assets的使用
查看>>
UINode扩展
查看>>
LINUX常用命令
查看>>