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 ...
随机推荐
- elasticsearch如何使用?
ES和关系型数据库的数据对比 1.创建索引库PUT/POST都可以,索引库名称必须全部小写,不能以下划线开头,也不能包含逗号curl -XPUT 'http://192.168.136.131:920 ...
- Java 基本语法---Java方法
Java 基本语法---Java方法 0.概述 方法:就是用来解决一类问题的代码的有序组合,是一个功能模块: 在方法部分,只使用对象名词调用方法: Scanner sc = new Scanner(S ...
- CRT软件光标不闪烁
点击 选项->会话选项 然后在取消即可,就有了闪烁的光标,应该是个bug 也可以把后面的浏览器之类的东西缩小一下,也会恢复
- vector的reserve和resize(转)
转自:http://www.cnblogs.com/qlee/archive/2011/05/16/2048026.html vector 的reserve增加了vector的capacity,但是它 ...
- java Stack(栈)
"Stack" 通常时指"后进后出"(LIFO)的容器,有时栈也被称为叠加栈,因为最后"压入"栈的元素,第一个"弹出"栈 ...
- ***linux下安装xampp,XAMPP目录结构(阿里云安装xampp)
XAMPP目录结构 重要的文件和目录 文件/目录 用途 /opt/lampp/bin/ XAMPP 命令库.例如 /opt/lampp/bin ...
- OpenStack中的Multipath faulty device的成因及解决(part 1)
| 版权:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.如有问题,可以邮件:wangxu198709@gmail.com 简介: Multip ...
- PHP 与redis 操作添加处理投票
<?php header("Content-Type:text/html;charset=utf-8"); include 'lib/mysql.class.php'; $m ...
- [转] 对vuex的表象理解(笔记)
一个东西,首先要知道为什么用它,为什么要vuex,官方解释为了解决繁杂事件订阅和广播,那么事件的$dispatch,$on,怎么就复杂了?许多人是不是感觉后者还挺简单的,对的 如果简单小型项目,那么不 ...
- 【PAT】1052 Linked List Sorting (25)(25 分)
1052 Linked List Sorting (25)(25 分) A linked list consists of a series of structures, which are not ...