How to update WPF browser application manifest and xbap file with ‘mage.exe’
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\BrowserOfHmi
RMDIR /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.log cd..
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 去掉.deploy
rename "..\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 增加.deploy
ren "..\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
How to update WPF browser application manifest and xbap file with ‘mage.exe’的更多相关文章
- 使用IE9、FireFox与Chrome浏览WPF Browser Application(.XBAP)的方式
最近开始写一些WPF的小Sample和文章,但是毕竟WPF应用程式不像Silverlight那么方便的只要装个Plugin就可以透过浏览器来看执行结果,因此把脑筋动到了改用WPF Browser Ap ...
- WPF, WPF Browser Application(XBAP) 和 Silverlight 的区别
由图可见,XBAP与WPF的区别是“受限的”:Silverlight与XBAP的区别是,不需要.NET Framework. 上星期與以前的同事爭論著究竟使用XBAP來開發XX用戶端 (為筆者之前開發 ...
- WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null
原文:WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null 在 WPF 程序中,可能会存在 Application.Current.D ...
- WPF的Application类
本节主要介绍一下Application类的部分功能,我们首先来看一下如何使用Application类来加载一个窗口: 我们首先创建一个控制台程序,并引入相关的dll,然后修改Main()方法. [ST ...
- WPF之application对象
WPF:Application简介 Application是一个地址空间,在WPF中应用程序就是在System.Windows命名空间下的一个Application实例.一个应用程序只能对应一个App ...
- WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null
原文:WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null 在 WPF 程序中,可能会存在 Application.Curren ...
- Walkthrough: My first WPF desktop application
Walkthrough: My first WPF desktop application This article shows you how to develop a Windows Presen ...
- Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques
Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...
- keil编译STM32工程时 #error directive: "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"
我们可以双击错误,然后会自动定位到文件 stm32f10x.h 中出错的地方,可以看到代码: #if !defined (STM32F10X_LD) && !defined (STM3 ...
随机推荐
- su: cannot set user id: Resource temporarily unavailable【转】
今天R&D所在主机出现su: cannot set user id: Resource temporarily unavailable资源不可用报错,直接通过其他机器ssh huyuh@xxx ...
- 014_mac下的端口查看
一. 使用netstat去过滤listen效果不怎么理想. $ netstat -an|grep -i --color "listen" tcp6 0 0 ::1.5601 *.* ...
- HighCharts、EChart图表X轴纵向显示
HighCharts 回调javascript函数来格式化标签,值通过this.value获得,this的其他属性还包括axis, chart, isFirst and isLast. 默认为: fu ...
- jTessBoxEditor工具进行Tesseract3.02.02样本训练
1.背景 前文已经简要介绍tesseract ocr引擎的安装及基本使用,其中提到使用-l eng参数来限定语言库,可以提高识别准确率及识别效率. 本文将针对某个网站的验证码进行样本训练,形成自己的语 ...
- Data Visualization Books
Data Visualization: Principles and Practice
- .NetCore下使用Prometheus实现系统监控和警报 (三)集成Grafana
有了前面InfluxDB的经验,这里就很好处理了,数据类型选择Prometheus选地址等,填好保存 同样通过导入数据处理,我们在https://grafana.com/dashboards上选择Da ...
- STM32 串口通信使用奇偶校验
STM32串口通信如果使用奇偶校验,需要设置数据位长度为9bit USART_InitStructure.USART_BaudRate = 9600; USART_InitStructure.USAR ...
- NET 异步多线程,THREAD,THREADPOOL,TASK,PARALLEL
.NET 异步多线程,THREAD,THREADPOOL,TASK,PARALLEL,异常处理,线程取消 今天记录一下异步多线程的进阶历史,以及简单的使用方法 主要还是以Task,Parallel为主 ...
- 【LOJ】#2076. 「JSOI2016」炸弹攻击
题解 我冷静一下,话说如果去掉建筑和R的限制好像是模拟退火吧 然后开始写模拟退火了,起始点就随机一个敌人作为起始点 没对着数据写了一下获得了70pts,感到美滋滋 然后对着数据卡了很久--发现有个数据 ...
- CUDA安装出现图形驱动程序安装失败
win7安装cuda9时出现图形驱动程序安装失败,解决办法是右键计算机>管理>服务和应用程序>服务>找到“Windows Installer”,右键选择“启动” 参考自http ...