[英]How do I turn my release project into an installer in Visual Studio 2019 Community Edition?
I have a C# WinForms project in Visual Studio 2019, and I am trying to turn my finished code into something that a user can just download (don't mind what file type, just something that works on Windows).我在 Visual Studio 2019 中有一个 C# WinForms 项目,我正在尝试将我完成的代码变成用户可以下载的东西(不介意什么文件类型,只要在 Windows 上工作)。
I have seen this thread and the first answer, however that was from 2013 and used VS2008, which has long been changed.我已经看到了这个线程和第一个答案,但是那是从 2013 年开始使用的 VS2008,它早已被改变了。
Please note I would like to do this through Visual Studio, not third party software like WiX or the like.请注意,我想通过 Visual Studio 执行此操作,而不是像 WiX 等第三方软件。
I am using Visual Studio 2019 Community Edition我正在使用 Visual Studio 2019社区版
You need an extension that didn't get installed by default:您需要一个默认未安装的扩展:
Microsoft Visual Studio Installer Projects. Microsoft Visual Studio 安装程序项目。
Read this topic in microsoft forum (and yes is a Microsoft extension not a third party one)在 microsoft 论坛中阅读此主题(是的,是 Microsoft 扩展而不是第三方扩展)
You don't always need to create an installation project.您并不总是需要创建安装项目。
You can just publish your project - the option is under the Build menu.您可以只发布您的项目 - 该选项位于 Build 菜单下。 In the opened window, select to show all settings and change them to something similar to:
在打开的 window、select 中显示所有设置并将它们更改为类似于以下内容:
Save the changes, and then select to Publish your application.保存更改,然后 select 以发布您的应用程序。
The best way is to create a setup package, it can be an MSI, EXE or MSIX.最好的方法是创建一个设置 package,它可以是 MSI、EXE 或 MSIX。 You can do this directly from Visual Studio, without using any third party software.
您可以直接从 Visual Studio 执行此操作,而无需使用任何第三方软件。
You can create an MSI or EXE using Microsoft's Installer Project template .您可以使用Microsoft 的安装程序项目模板创建 MSI 或 EXE。 This is recommended if you are targeting users running on olders OSes like Windows 7/8, etc... or if your application has deep system integrations, like services, shell menu extensions, etc... or it simply needs to be installed per machine (for all users)
如果您的目标用户是在 Windows 7/8 等较旧的操作系统上运行的用户,或者如果您的应用程序具有深度系统集成,如服务、shell 菜单扩展等...或者只需安装机器(适用于所有用户)
If you are targeting only Windows 10 users (1709 or newer) and your application dos not require administrative APIs (resources like services, shell, etcc or sharing files with other applications) you could use Microsoft's support to build MSIX packages.如果您仅针对 Windows 10 个用户(1709 或更高版本)并且您的应用程序不需要管理 API(如服务、shell 等资源或与其他应用程序共享文件),则可以使用Microsoft 的支持来构建 MSIX 包。
Deploying and updating and MSIX is much simpler both for you and for the end-users, but it comes with some limitations, as mentioned above, for security reasons.对于您和最终用户而言,部署和更新 MSIX 都更加简单,但出于安全原因,如上所述,它有一些限制。
Also, MSIX requires all setup packages to be digitally signed.此外,MSIX 要求对所有安装程序包进行数字签名。 You can use a code signing certificate purchased from a certified vendor or your can generate your own certificate (but this needs to be accepted by the end-user machines, so you need a way to deploy this certificate to their machines before giving them the MSIX. If you are inside an enterprise network, this can be easily done, for home users is not recommended).
您可以使用从经过认证的供应商处购买的代码签名证书,也可以生成自己的证书(但这需要最终用户机器接受,因此您需要一种方法将此证书部署到他们的机器上,然后再向他们提供 MSIX .如果你在企业网络里面,这个可以很容易做到,对于家庭用户不推荐)。
If you are interested in MSIX, let me know and I can give you more details about digital signing or other questions you might have.如果您对 MSIX 感兴趣,请告诉我,我可以为您提供有关数字签名或您可能遇到的其他问题的更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.