简体   繁体   English

从ClickOnce迁移到MSI部署的策略

[英]Strategy for moving from ClickOnce to MSI deployment

We have a consumer app in the market that uses ClickOnce deployment. 我们在市场上有一个使用ClickOnce部署的消费者应用程序。 We've had various issues over time with ClickOnce, most of which have been resolved, but kind of always regretted not going with a straightforward MSI installer. 随着时间的推移,我们遇到过各种各样的问题,其中大部分都已经解决,但总是很遗憾没有使用简单的MSI安装程序。 In particular we'd like to be able to offer proper offline installs (from a boxed copy), and better multi-lingual installation options. 特别是我们希望能够提供适当的离线安装(从盒装副本),以及更好的多语言安装选项。 We have just updated our beta to an AnyCPU build after finally getting shot of some old 32 bit dll dependencies (before you ask - yes, our app can really benefit from the increase in memory address space, we crunch a lot of data). 在最终获得一些旧的32位dll依赖项后,我们刚刚将测试版更新为AnyCPU版本(在您提出之前 - 是的,我们的应用程序确实可以从内存地址空间的增加中受益,我们处理大量数据)。 Now of course we realise that going from x86 to AnyCPU doesn't work with ClickOnce, so it seems like the ideal time to make the switch away to another install technology. 现在我们当然意识到从x86到AnyCPU不适用于ClickOnce,因此它似乎是切换到另一种安装技术的理想时间。

SO here's the issue: we want to upgrade automatically to the new installer, from existing ClickOnce installations. 这就是问题所在:我们希望从现有的ClickOnce安装中自动升级到新的安装程序。 We would also very much like to keep the user settings (.config) file. 我们也非常希望保留用户设置(.config)文件。 Not a total deal breaker if we can't, but it will irritate a lot of users if we don't. 如果我们做不到,那就不是一个彻底的交易破坏者,但如果我们不这样做,它会激怒很多用户。

So the very rough gameplan is something like this: 所以非常粗略的游戏规划是这样的:

Create a new version of the app and deploy via ClickOnce. 创建应用程序的新版本并通过ClickOnce进行部署。 This new version is basically a front-end for the MSI installer. 这个新版本基本上是MSI安装程序的前端。 It somehow grabs the existing user settings, sets off a download of the new installer and invokes it. 它以某种方式抓取现有的用户设置,启动新安装程序的下载并调用它。 Then it copies the existing settings to the new application directory. 然后,它将现有设置复制到新的应用程序目录。 Then it uninstalls itself (itself being the previous, ClickOnce, installation of the app). 然后它卸载自己(本身就是以前的ClickOnce安装应用程序)。

In principle I think that could work, but am unsure about how to go about it. 原则上我认为这可行,但我不确定如何去做。 Particularly the moving of the user settings to the new application, and self-uninstalling at the end. 特别是将用户设置移动到新应用程序,并在最后自行卸载。

If anyone has any tips, or has gone through a similar process, I'd be very keen to hear about it. 如果有人有任何提示,或经历过类似的过程,我会非常渴望听到它。

Application is c# targeting .NET 4. 应用程序是针对.NET 4的c#。

thanks, Matt 谢谢,马特

Create an msi version with the following features: 创建具有以下功能的msi版本

  • Grab application settings etc from the ClickOnce installation. 从ClickOnce安装中获取应用程序设置等。 If it is the first start of the msi version for the current user, check if there is a ClickOnce version and copy/migrate the settings from there. 如果它是当前用户的msi版本的第一个启动,请检查是否存在ClickOnce版本并从那里复制/迁移设置。 I would not try to do the opposite way and push the settings from ClickOnce to msi because (1) there may be several ClickOnce installations with different settings and you may want to copy all of them and (2) You would have to put migration logic into the old version (which may be required to change for compatibility with future msi installed versions). 我不会尝试以相反的方式将ClickOnce中的设置推送到msi,因为(1)可能有多个具有不同设置的ClickOnce安装,您可能希望复制所有这些并且(2)您必须放置迁移逻辑进入旧版本(可能需要更改与未来msi安装版本的兼容性)。 The ideal approach, however, would be to just keep using the application settings as they were. 然而,理想的方法是继续使用应用程序设置。 If they are somewhere in the user profile (outside the ClickOnce installation), it should not matter how the application has been installed. 如果它们位于用户配置文件中的某个位置(在ClickOnce安装之外),那么应用程序的安装方式无关紧要。
  • Detect the ClickOnce version, offer the user to uninstall it. 检测ClickOnce版本,提供用户卸载它。 The ClickOnce version is installed once per user while the msi version can be installed for all users. 每个用户安装一次ClickOnce版本,同时可以为所有用户安装msi版本。 If you started the uninstallation from within the ClickOnce version, you would only ever uninstall one of potentially several ClickOnce installations. 如果你开始从ClickOnce版本中卸载,你永远只能卸载几个潜在的ClickOnce安装项目之一 If you do it as described here, every user will be reminded to uninstall his ClickOnce version once he starts the application (in ClickOnce or msi version). 如果按照此处的说明执行此操作,将提醒每个用户在启动应用程序后(在ClickOnce msi版本中)卸载他的ClickOnce版本。

Create a new ClickOnce version which detects the msi installed version. 创建一个新的ClickOnce版本,用于检测msi安装的版本。

  • If no msi version is installed, tell the user about the new installer and offer him to download and run the new installer or do it later . 如果没有安装msi版本,请告诉用户有关新安装程序的信息,并让他下载并运行新安装程序或稍后再执行 I would not remove all other functionality. 我不会删除所有其他功能。 That could be a very evil surprise for a user. 对于用户来说,这可能是一个非常邪恶的惊喜。 You should give the user the possibility to postpone the upgrade and use the existing version for some time. 您应该让用户推迟升级并使用现有版本一段时间。 Remember that the user most likely did not need admin rights to update the ClickOnce-installed version but will need admin rights to install the msi. 请记住,用户很可能不需要管理员权限来更新ClickOnce安装的版本,但需要管理员权限才能安装msi。
  • If it has been installed already, start the msi installed version and shutdown the ClickOnce version immediately. 如果已经安装,请启动msi安装版本并立即关闭ClickOnce版本。 The less rigorous version would be to only inform the user. 不太严格的版本只是通知用户。 However, I would prefer to force the user to use the newer version once it is installed. 但是,我宁愿强制用户在安装后使用较新的版本。 Otherwise you may have compatibility issues in your working directory/application settings (depending on the exact structure of your application, of course). 否则,您的工作目录/应用程序设置可能存在兼容性问题(当然,取决于应用程序的确切结构)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM