Visual Studio 将项目发布到一个简单的安装程序中 [英] Visual Studio Publish Project Into One Simple Installer

查看:33
本文介绍了Visual Studio 将项目发布到一个简单的安装程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当大的项目,有多个类、500 多个图像和 20 多个与该项目相关的文本文件.

我一直在通过右键单击 project->properties 并单击发布选项卡来发布我的项目.我已经将文本文件和图像作为 resources 包含在内.

问题是,每当我安装应用程序时,通常它都是一个简单的安装程序,即您下载一个安装程序(一个文件,例如 installer.exe),运行此文件,然后该文件会引导您完成设置,例如安装位置它,等等.然后应用程序被安装,就是这样.

好吧,在发布我的应用程序时,我指定了一个输出目录,剩下这些文件:

  • 申请文件
  • MyProjectName.application(清单?)
  • setup.exe

如果我运行 setup.exe,我就可以安装应用程序并毫无问题地运行它.但是,它不仅不允许我选择安装它的位置,而且我必须将所有 3 个文件发送给用户.我试图只将 setup.exe 发送给一个朋友,它说他们缺少所需的文件(我假设这是 application files.application 用于).

我将如何将所有这些整合到一个安装程序中,一个更符合您安装企业应用程序的方式(考虑安装 chrome、eclipse、photoshop 等)?

我很高兴能够拥有一个安装程序文件,并且能够让用户下载该文件.

谢谢

解决方案

古人:如果下面是TL;DR(太长,没看),请浏览这两个链接:

<小时><块引用>

更新:2018 年 9 月 - 由于这个答案"最近被否决,让我尝试添加更多链接以查看答案可以更清楚.不要过于戏剧化,但是:

作为部署专家,当人们承诺使用一种工具时,我们必须警告他们,当更高级的部署要求总是浮出水面时,该工具必定会崩溃.

安装程序项目已多次被拉回然后在 Visual Studio 中重新引入.始终基于所看到的问题使用这些项目类型(只是较大的项目):

1) 不支持 MSBuild(没有经过我的广泛测试,但由其他人测试),2)仅在系统上下文中运行的延迟模式自定义操作(不可在 GUI 中插入),3) 总体控制非常有限(总是宣传快捷方式,无法配置某些东西等...), 4) 不支持正确的服务安装 - 需要自定义操作,5) 很少捆绑的可用先决条件,6) 基本的 GUI,灵活性很小,7) 似乎无法定义MSI 功能(如功能和组件中),8)自定义操作的 32/64 位问题 等...

有关此项目类型及其问题的旧 MSDN 页面:设置和部署项目疑难解答.

MSI 专家 Chris Painter 和其他人:

在我看来,项目类型仅适用于简单的 .NET 应用程序.任何复杂的口径,你都会遇到麻烦.SQL ScriptsIIS、正确的COM/COM+Users &GroupsSharesFirewall RulesCustom GUI 等……商业工具和 WiX 对这些东西有高级支持.编译后的 MSI 文件的内部结构也不符合标准(使用自注册、服务的自定义操作等...).我经常遇到该工具也因某些未知原因"而停止工作的情况.突然就不能编译了.具体示例(已修复).

替代方案:

开源 WiX 工具包具有一个名为Burn 来创建这样的setup.exe 启动器/下载器/引导程序 - 用于按顺序运行多个安装和/或安装先决条件(一个非常常见的任务 - Visual Studio 项目仅支持少数先决条件).

需要编写 WiX XML 标记代码才能使用此刻录功能.商业工具 Installshield高级安装程序提供 GUI 功能来构建这样的 setup.exe 文件.

<小时>

Visual Studio 安装程序 非常有限,我从不使用它.WiX(链接到试图为 WiX 速成课程提供一些链接的答案的链接)是一个成熟的开源部署解决方案.您需要一段时间才能掌握,但它非常好且灵活.InstallshieldAdvanced Installer 等商业解决方案可让您更快、更轻松地提供设置,但它们可能非常昂贵.

鉴于 Visual Studio 安装程序项目(和错误)的局限性,我相信正确的解决方案是使用不同的工具:要使用什么安装产品?InstallShield、WiX、Wise、高级安装程序等.如果你需要任何先进的东西,否则你会很挣扎.使用更高级的工具,至少可以做您需要的事情,即使有时可能会涉及更多.

让我知道您想了解这样的过程,我会尽力提供帮助.我不确定您提供的软件是什么,目标用户群是什么,您有多少预算等等...... Windows Installer 非常适合 许多企业优势,但也存在其他部署技术(请参阅上面对各种使用工具的说明).

I've got a sizable project, with multiple classes, 500+ images, and 20+ text files associated with said project.

I've been publishing my project via right clicking on the project->properties, and clicking on the publish tab. I've included the text files and images as resources already.

The issue is that whenever I install an application, usually it's a simple installer, i.e. you download an installer (one file such as installer.exe), run this file which then takes you through the setup, such as where to install it to, etc. Then the application is installed and that's it.

Well, when publishing my application, I specify an output directory, and I'm left with these files:

  • Application files
  • MyProjectName.application (the manifest?)
  • setup.exe

If I run setup.exe, I'm able to install the application and run it with no issues. However, not only does it not let me choose where to install it, but I would have to send all 3 of these files to the user. I tried to send just the setup.exe to a friend and it said they were missing the files required (which I'm assuming is what the application files and .application were for).

How would I go about bunching these all into one installer, one that more closely matches how you would install an enterprise application (think of installing chrome, eclipse, photoshop, etc)?

I've love to be able to have one file which is the installer and be able to have users download that.

Thank you

解决方案

The Ancients: If the below is TL;DR (too long, didn't read), please skim these two links:


UPDATE: September 2018 - Since this "answer" was recently downvoted, let me try to add some more links to see if the intent of the answer can be made more clear. Not to be overly dramatic, but:

As deployment specialists we have to warn people when they commit to using a tool that is bound to fall apart for them down the line when more advanced deployment requirements invariably surface.

The installer projects have several times been pulled back and then re-introduced in Visual Studio. Always based on the problems seen with these project types (just the bigger ones):

1) No MSBuild support (not tested extensively by me, but by others), 2) only deferred mode custom actions running in system context (not insertable in GUI), 3) highly limited control overall (always advertised shortcuts, no ability to configure certain things, etc...), 4) no support for proper service installation - requires custom actions instead, 5) very few available prerequisites to bundle, 6) rudimentary GUI with little flexibility, 7) appears to not be possible to define MSI features (as in features and components), 8) problems with 32 / 64 bitness issues for custom actions, etc...

An old MSDN page on this project types and its problems: Troubleshooting Setup and Deployment Projects.

MSI Expert Chris Painter and others:

In my opinion the project type can only work for simple.NET applications. Any complexity of caliber and you are in trouble. SQL Scripts, IIS, proper COM / COM+, Users & Groups, Shares, Firewall Rules, Custom GUI, etc... Commercial tools and WiX have advanced support for these things. The internals of the compiled MSI files are also sub-standard (use of self-registration, custom actions for services, etc...). I often experience that the tool stops working for "some unknown reason" as well. Suddenly it won't compile. Concrete Example (with fix).

Alternatives:

The open source WiX toolkit features a component called Burn to create such setup.exe launchers / downloaders / bootstrappers - used to run several installations in sequence and / or install prerequisites (a very common task - Visual Studio projects only support a few prerequisites).

Writing WiX XML markup code is necessary to use this Burn feature. Commercial tools Installshield and Advanced Installer provide GUI-features to build such setup.exe files.


The Visual Studio installer is very limited, I never use it. WiX (link to an answer trying to provide some links for a WiX crash course) is a full blown, open source deployment solution. It will take you a while to master, but it is very good and flexible. A commercial solution such as Installshield or Advanced Installer will allow you to deliver a setup faster and easier, but they can be very pricey.

Given the limitations of Visual Studio Installer projects (and bugs), I do believe the right solution is to use a different tool: What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc. If you need anything advanced at all, you will struggle otherwise. With a more advanced tool it is at least possible to do what you need, even if it might be more involved at times.

Let me know what you want to know about such a process, and I will try to help. I am not sure what software you are delivering, what the target user group is, what budget you have, etc... Windows Installer is highly desirable for a number of corporate benefits, but other deployment technologies exist (see the description above of various tools to use).

这篇关于Visual Studio 将项目发布到一个简单的安装程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆