ClickOnce 部署恐怖
ClickOnce deployment horrors
我在 ClickOnce 部署后签署应用程序时遇到问题。
该应用程序是一个包含 3 个 class 库项目的 winforms 项目,并部署到共享文件路径。
Publish from Visual Studio 有效,如果我 运行 应用程序安装正常,尽管 Windows 10 中有关于它无法识别的警告:
所以作为一个愚蠢地乐于助人的程序员,我想我应该尝试为我的用户删除警告消息。
- 第一步是创建签名证书。幸运的是,系统管理员能够为我创建一个内部证书,我设法弄清楚如何导出它 this。
- 然后我用了Mage UI to sign the manifest. What a "manifest" was exactly I did not know at this stage. Where to find Mage was also an issue as the Windows SDK were not installed on the deployment server. I eventually remoted into the deployment server and ran Mage from my own PC. Using Mage to sign random files I eventually worked out that I needed to sign ALL the .application + .manifest files mentioned in the file structure of this answer.
- 此时我遇到了
Reference in the manifest does not match the identity of the downloaded assembly
错误,在尝试了 this question 中提到的 10 种不同尝试后,我开始在这里发帖。
- 然后我发现 this MSDN article 他们建议文件在某种程度上已损坏。哪个文件?好吧,在比较前后的文件后,我注意到 .application 文件仍然有 .manifest 文件的产品密钥 =“000000000000000”,而不是新的签名产品密钥。
- 所以我回到 Mage 并重新选择清单的“应用程序参考”并再次签名。在这一点上我得到了另一个错误
could not find a part of the path \MyFileShare\Application%20Files\MyApplication_1_0_0_23\MyApplication.exe.manifest
- 最终我发现 Mage 使用 urlencoding 愉快地破坏了文件路径。我在记事本中将
%20
修复为
并在 Mage AGAIN 中辞职并且成功了!!!
肯定是我做错了什么,Microsoft 并没有打算让这件事变得如此困难?
TLDR;
运行Mage 一次性签署应用程序而无需手动编辑文件并多次退出的正确方法是什么?
根据我的经验,自动化工具与 ClickOnce 及其相关工具的所有来龙去脉配合得很好,但手工操作是一个真正的挑战。
对我非常有用的资源是 Walkthrough: Manually Deploying a ClickOnce Application and Walkthrough: Manually Deploying a ClickOnce Application that Does Not Require Re-Signing and that Preserves Branding Information。
选项:
- 使用 Visual Studio 提供的自动化工具来签署和部署您的应用程序。 (它也有缺点,但至少有点用);
- 像您目前所做的那样,花大量时间自动化和调整您的流程。最后你会从中受益,因为你对最终结果有更多的控制权;
- 使用其他一些部署方法,例如 MSI。
正如 Marco Guignard 在评论中指出的那样,可以导出从 任何地方 创建的证书并将其导入您的个人商店以在 Visual Studio 中使用。
在 Visual Studio (pictures) 中签名并设置单独的发布 + 安装位置让我完全不需要使用 mage!
我在 ClickOnce 部署后签署应用程序时遇到问题。
该应用程序是一个包含 3 个 class 库项目的 winforms 项目,并部署到共享文件路径。
Publish from Visual Studio 有效,如果我 运行 应用程序安装正常,尽管 Windows 10 中有关于它无法识别的警告:
所以作为一个愚蠢地乐于助人的程序员,我想我应该尝试为我的用户删除警告消息。
- 第一步是创建签名证书。幸运的是,系统管理员能够为我创建一个内部证书,我设法弄清楚如何导出它 this。
- 然后我用了Mage UI to sign the manifest. What a "manifest" was exactly I did not know at this stage. Where to find Mage was also an issue as the Windows SDK were not installed on the deployment server. I eventually remoted into the deployment server and ran Mage from my own PC. Using Mage to sign random files I eventually worked out that I needed to sign ALL the .application + .manifest files mentioned in the file structure of this answer.
- 此时我遇到了
Reference in the manifest does not match the identity of the downloaded assembly
错误,在尝试了 this question 中提到的 10 种不同尝试后,我开始在这里发帖。 - 然后我发现 this MSDN article 他们建议文件在某种程度上已损坏。哪个文件?好吧,在比较前后的文件后,我注意到 .application 文件仍然有 .manifest 文件的产品密钥 =“000000000000000”,而不是新的签名产品密钥。
- 所以我回到 Mage 并重新选择清单的“应用程序参考”并再次签名。在这一点上我得到了另一个错误
could not find a part of the path \MyFileShare\Application%20Files\MyApplication_1_0_0_23\MyApplication.exe.manifest
- 最终我发现 Mage 使用 urlencoding 愉快地破坏了文件路径。我在记事本中将
%20
修复为
肯定是我做错了什么,Microsoft 并没有打算让这件事变得如此困难?
TLDR;
运行Mage 一次性签署应用程序而无需手动编辑文件并多次退出的正确方法是什么?
根据我的经验,自动化工具与 ClickOnce 及其相关工具的所有来龙去脉配合得很好,但手工操作是一个真正的挑战。
对我非常有用的资源是 Walkthrough: Manually Deploying a ClickOnce Application and Walkthrough: Manually Deploying a ClickOnce Application that Does Not Require Re-Signing and that Preserves Branding Information。
选项:
- 使用 Visual Studio 提供的自动化工具来签署和部署您的应用程序。 (它也有缺点,但至少有点用);
- 像您目前所做的那样,花大量时间自动化和调整您的流程。最后你会从中受益,因为你对最终结果有更多的控制权;
- 使用其他一些部署方法,例如 MSI。
正如 Marco Guignard 在评论中指出的那样,可以导出从 任何地方 创建的证书并将其导入您的个人商店以在 Visual Studio 中使用。
在 Visual Studio (pictures) 中签名并设置单独的发布 + 安装位置让我完全不需要使用 mage!