简体   繁体   English

.net core 3 wpf/winforms(非 MSIX)的安装程序?

[英]Installer for .net core 3 wpf/winforms (non MSIX)?

So, we finished a few wpf conversions to .net core, and now we have a need to ship one to an external client as an installer.所以,我们完成了一些 wpf 到 .net core 的转换,现在我们需要将一个作为安装程序发送到外部客户端。 Previously we used ClickOnce, but that has been deprecated in .net core and will not be ported according to MS, with them recommending MSIX.以前我们使用 ClickOnce,但它在 .net core 中已被弃用,并且不会根据 MS 进行移植,他们推荐 MSIX。 However, as we understood from docs, even though we'll sideload a WPF application it will still run in a sandbox with a virtualized file system.但是,正如我们从文档中了解到的,即使我们将旁加载 WPF 应用程序,它仍将在具有虚拟化文件系统的沙箱中运行。 And that is a no go for us, it has obviously been designed with UWP+Marketplace delivery in mind.这对我们来说是行不通的,它显然在设计时就考虑到了 UWP+Marketplace 交付。 We need the application on the file system with full access to file system, the "good old way".我们需要文件系统上的应用程序具有对文件系统的完全访问权限,“老方法”。

We could just ship them as a zip file and have the client unpack, but management deemed that as not-so-professional, so we need a delivery package similar to what msi/clickonce had.我们可以将它们作为 zip 文件发送并让客户解压缩,但管理层认为这不太专业,所以我们需要一个类似于 msi/clickonce 的交付包。 Has anyone delivered apps on core outside MSIX?有没有人在 MSIX 之外的核心上交付过应用程序?

EDIT: Microsoft has announced they are going to include ClickOnce support in .NET 5编辑:微软已经宣布他们将在 .NET 5 中包含 ClickOnce 支持

You can deploy .NET Core and .NET 5 applications internally in an organization by sideloading msix packages.您可以通过旁加载 msix 包在组织内部部署 .NET Core 和 .NET 5 应用程序。

I have been successfully using Clickonce for deploying .NET line of business applications for years.多年来,我一直成功地使用 Clickonce 来部署 .NET 业务线应用程序。

Now that I'm updating my apps to .NET Core I wanted something similar to Clickonce.现在我正在将我的应用程序更新到 .NET Core,我想要类似于 Clickonce 的东西。 In other words: publishing your installer in a network share and deploying your autoupdating app to your clients by simply coping a shortcut to your installer.换句话说:通过简单地处理安装程序的快捷方式,在网络共享中发布您的安装程序并将您的自动更新应用程序部署到您的客户端。

You can achieve this with msix packages.您可以使用 msix 包来实现这一点。 The problem is that you are limited to Windows 10 version 1709, and later问题是您仅限于 Windows 10 版本 1709 及更高版本

The solution came on December 19th with MSIX Core 1.1 .解决方案于 12 月 19 日随MSIX Core 1.1 一起出现 Packaging your app with msix core support you can target Windows 7 SP1 and later, and this is something I needed because at work we are slowly transitioning to Windows 10 from Windows 7 and I still have to support old versions of windows.使用 msix 核心支持打包您的应用程序,您可以面向 Windows 7 SP1 及更高版本,这是我需要的东西,因为在工作中,我们正在慢慢地从 Windows 7 过渡到 Windows 10,我仍然必须支持旧版本的 Windows。

The steps for packaging your .net core app using msix core are:使用 msix core 打包 .net core 应用程序的步骤是:

  1. Create a Windows application packaging project in your solution.在您的解决方案中创建一个 Windows 应用程序打包项目。

  2. Right click on the Applications subfolder of your Windows application packaging project and select Add Reference.右键单击 Windows 应用程序打包项目的 Applications 子文件夹,然后选择 Add Reference。 Then select your target project.然后选择您的目标项目。

  3. Change your Package.manifest (reference: msix-packaging/MsixCore at master · microsoft/msix-packaging · GitHub ) Right click your Package.manifest file and select View code Change your to:更改您的 Package.manifest(参考: msix-packaging/MsixCore at master · microsoft/msix-packaging · GitHub )右键单击您的 Package.manifest 文件并选择查看代码将您的更改为:

     <Dependencies> <TargetDeviceFamily Name="MSIXCore.Desktop" MinVersion="6.1.7601.0" MaxVersionTested="10.0.10240.0" /> <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.16299.0" MaxVersionTested="10.0.18362.0" /> </Dependencies>

    With this you stablish your min version to MSIXCore.Desktop in other words Windows 7 sp1.有了这个,您可以将您的最小版本稳定到 MSIXCore.Desktop,即 Windows 7 sp1。

  4. Right click your Windows application packaging project and select Publish then Create App Packages.右键单击您的 Windows 应用程序打包项目,然后选择发布,然后选择创建应用程序包。

  5. Choose Sideloading then check Enable automatic updates.选择旁加载,然后选中启用自动更新。

    选择

  6. In order to install the package in the client machine you must sign it.为了在客户端机器中安装软件包,您必须对其进行签名。 I recommend you to create a self-signed certificate.我建议您创建一个自签名证书。 You must install the certificate in the client machine so that the package is trusted and you can install it.您必须在客户端计算机中安装证书,以便该软件包受信任并且您可以安装它。 If you are in a domain you can deploy your self-signed certificate with a group policy.如果您在域中,则可以使用组策略部署自签名证书。 The optimal situation is to sign the package with a trusted certificate provided by a trusted root certification authority.最佳情况是使用受信任的根证书颁发机构提供的受信任证书对包进行签名。 My personal choice is to create a certificate in my own windows certification authority (which is trusted in my local domain).我个人的选择是在我自己的 Windows 证书颁发机构(在我的本地域中受信任)中创建一个证书。 If you decide to sign your package with a trusted cert this is the command line:如果您决定使用受信任的证书签署您的包,这是命令行:


  .\SignTool.exe sign /fd SHA256 /a /f yourcert.pfx /p yourpassword *.appx

  1. Select Generate app bundle to Never.选择从不生成应用程序包。

图像-20200521005823248

  1. Select your network share for publishing the package选择用于发布包的网络共享

图像-20200521003324900

In order to execute your package installer in Windows 7 sp1 machines you must previously install msixmgrSetup-1.1.0.0-x64.msi or msixmgrSetup-1.1.0.0-x86.msi accordingly.为了在 Windows 7 sp1 机器上执行您的包安装程序,您必须事先相应地安装 msixmgrSetup-1.1.0.0-x64.msi 或 msixmgrSetup-1.1.0.0-x86.msi。 You can find the installer here您可以在此处找到安装程序

Windows 10 machines will recognize the installer right away. Windows 10 机器将立即识别安装程序。

If you want to know more about msix packages you have a good explanation here如果您想了解有关 msix 软件包的更多信息,请在此处提供很好的解释

I hope this guide helps you to get your deployment system working.我希望本指南可以帮助您使部署系统正常工作。

Well, apparently, we are again faced with "our way or the highway" from MS, so we just used Inno Setup.好吧,显然,我们再次面临来自 MS 的“我们的方式或高速公路”,所以我们只使用了 Inno Setup。 Until such time we get a proper installation process or MSIX allows unsandboxed setup without unnecessary file system abstraction, this will have to do.在我们获得正确的安装过程或 MSIX 允许没有不必要的文件系统抽象的非沙盒安装之前,这将是必须的。

There are other tools such as Advanced Installer or InstallShield that can create a MSI/EXE installer now and later in case you decide to go with the MSIX, you will just add a new build to your current project.还有其他工具,例如 Advanced Installer 或 InstallShield,它们现在可以创建 MSI/EXE 安装程序,以后如果您决定使用 MSIX,您只需向当前项目添加一个新版本即可。

The tool will automatically sync the content of the MSI with the MSIX, or at least this is what Advanced Installer does for you.该工具将自动将 MSI 的内容与 MSIX 同步,或者至少这是 Advanced Installer 为您所做的。

They also have a VS Extension, so you can build the installer inside your Visual Studio IDE.它们还有一个 VS 扩展,因此您可以在 Visual Studio IDE 中构建安装程序。

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

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