老外参考文章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 @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’的更多相关文章

  1. 使用IE9、FireFox与Chrome浏览WPF Browser Application(.XBAP)的方式

    最近开始写一些WPF的小Sample和文章,但是毕竟WPF应用程式不像Silverlight那么方便的只要装个Plugin就可以透过浏览器来看执行结果,因此把脑筋动到了改用WPF Browser Ap ...

  2. WPF, WPF Browser Application(XBAP) 和 Silverlight 的区别

    由图可见,XBAP与WPF的区别是“受限的”:Silverlight与XBAP的区别是,不需要.NET Framework. 上星期與以前的同事爭論著究竟使用XBAP來開發XX用戶端 (為筆者之前開發 ...

  3. WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null

    原文:WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null 在 WPF 程序中,可能会存在 Application.Current.D ...

  4. WPF的Application类

    本节主要介绍一下Application类的部分功能,我们首先来看一下如何使用Application类来加载一个窗口: 我们首先创建一个控制台程序,并引入相关的dll,然后修改Main()方法. [ST ...

  5. WPF之application对象

    WPF:Application简介 Application是一个地址空间,在WPF中应用程序就是在System.Windows命名空间下的一个Application实例.一个应用程序只能对应一个App ...

  6. WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null

    原文:WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null 在 WPF 程序中,可能会存在 Application.Curren ...

  7. Walkthrough: My first WPF desktop application

    Walkthrough: My first WPF desktop application This article shows you how to develop a Windows Presen ...

  8. Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques

    Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...

  9. 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 ...

随机推荐

  1. fuzz for test of the Net::HTTP::GET

    use Net::HTTP::GET; % %0e%0f ' *%26 @.jpg>; my $count = 0; for @chars X @chars X @chars X @chars ...

  2. gbk文件转为utf8文件

    convmv -f gbk -t utf- --notest -r ./

  3. Spring面试问答25题

    1.什么是Spring框架?Spring框架有哪些主要模块? Spring框架是一个为Java应用程序的开发提供了综合.广泛的基础性支持的Java平台.Spring帮助开发者解决了开发中基础性的问题, ...

  4. C#排队处理DEMO

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  5. thymeleaf-extras-shiro

    thymeleaf-extras-shiro 转载:https://github.com/theborakompanioni/thymeleaf-extras-shiro A Thymeleaf di ...

  6. Java与PHPweb开发比较

    参考:https://blog.csdn.net/loophome/article/details/83413878

  7. express-partials使用方法

    1.安装express-partials 方法一:运行cmd用npm install express-partials 方法二:在package.json里面的dependencies添加" ...

  8. HNOI2019滚粗记

    HNOI2019滚粗记 标签: 游记 Day -1 在学校打摆被抓. Day 0 在家打摆. Day 1 来长沙理工大学打摆 开场看完题之后,感觉T3不太可做,然后T1T2又显得特别套路,然后把T2 ...

  9. zTree搜索

    自写 zTree搜索功能 -- 关键字查询 -- 递归无限层 唠叨一哈 前两天朋友跟我说要一个ztree的搜索功能,我劈头就是一巴掌:这种方法难道无数前辈还做少了?自己去找,我很忙~然后我默默地蹲着写 ...

  10. 兼容到ie10的js文件导出、下载到本地

    话不多说,上代码: try { let reader = new FileReader(); let blob = new Blob([res.data], { type: 'application/ ...