Visual Studio 安装程序 UI 集成 [英] Visual Studio Installer UI integration

查看:38
本文介绍了Visual Studio 安装程序 UI 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为 Visual Studio 2013 安装程序项目提供自定义 UI(https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d)?setup.exe 和 .msi 之间有什么区别?有没有很好的例子来解释 VS 安装程序?

Is it possible to have a custom UI for Visual Studio 2013 Installer project ( https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d )? What's different between setup.exe and .msi? Is there a good example explaining VS Installer?

任务是创建类似 VS2013 的安装程序,它从网络下载最新文件(URL 是硬编码的).据我了解,setup.exe 应该从网上获取最新的 .msi 文件,下载并运行它?因此,setup.exe 需要以某种方式进行自定义.这可能吗?

The task is to create VS2013 like installer, which downloads the latest files from the web (URL is hardcoded). As I understand, setup.exe should get the latest .msi file from the web, download it and run it? Therefore, setup.exe needs to be customized somehow. Is that possible?

推荐答案

在 VS 安装世界中,setup.exe 是一个引导程序,它安装先决条件然后运行您的 MSI.如果您没有先决条件,则不需要 setup.exe.

In the VS setup world, setup.exe is a bootstrapper that installs prerequisites and then runs your MSI. If you have no prerequisites you don't need setup.exe.

还有其他工具可以让您自定义 UI - 只是 VS 不支持.WiX 和(完整的)InstallShield 等工具可让您在 MSI 对话框的功能范围内构建自己的 UI.在只安装一个 MSI 文件的情况下,人们通常会这样做.

There are other tools that let you customize the UI - it's just that VS doesn't support that. Tools like WiX and (full) InstallShield let you build your own UI within the capabilities of MSI dialogs. In the case where there is just one MSI file being installed that's usually all that people do.

请注意,MSI 对话框与 .NET 对话框或控件无关 - 这就是它们非常基础的原因.里面没有 C#,只有 MSI 内部支持的控件和对话框.您根本无法使用自己的 C# 对话框.

Note that MSI dialogs are nothing to do with .NET dialogs or controls - that's why they are very basic. There's no C# in there, just the controls and dialogs that MSI supports internally. You don't get to use your own C# dialogs at all.

如果您想安装多个 MSI 文件,就好像它是一个产品一样(我相信 SQL Server、Office、Visual Studio 也是如此),那么您需要一个包装器(WiX 有 Burn bootstrapper,InstallShield 有一个链接器)) 使它看起来像一个单一的设置.如果是这种情况,或者您希望拥有完全自定义的 C# 对话框 UI,那么您可以自己编写 - 或者像这些人一样基于 WiX 框架构建:

In the case where there are multiple MSI files that you want to install as if it's a single product (SQL Server, Office, Visual Studio too I believe) then you need a wrapper (WiX has Burn bootstrapper, InstallShield has a chainer) to make it look like a single setup. If this is the case OR you want you own completely custom C# dialog UI then you write your own - or build on the WiX framework like these guys:

http://www.wrightfully.com/part-1-of-writing-your-own-net-based-installer-with-wix-overview/

http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

架构基于此:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb309215(v=vs.85).aspx

和 MsiSetExternalUIRecord.基本上,您编写代码来安装一个或多个 MSI,而 Windows Installer 在安装过程中为每个事件回调到您的代码中.这是您拥有自己的启动对话框的地方,Windows Installer 将回调您显示的进度消息,以及错误、使用情况中的文件等.使用像 WiX 这样的工具更容易使用它提供了大部分框架那.

and MsiSetExternalUIRecord. Basically you write code to install one or MSIs while Windows Installer calls back into your code for each event during the install. This is where you have you own startup dialogs, and Windows Installer will call back with progress messages for you to display, as well as errors, files in use situations etc. It's easier to use a tool like WiX that's provided most of the framework for that.

所以这取决于您所说的自定义对话框是什么意思.如果您只是想说不像 Visual Studio"或我需要一个对话框来输入 VS 不提供的内容",并且您有一个 MSI 需要安装,那么 WiX、InstallShield、Advanced Installer 和其他工具都可以做到这一点.如果您的意思是我想要我自己的完全自定义的 C# 对话框",那么您需要使用 C# 互操作与 MsiSetExternalUIRecord 或使用 WiX boostrapper 编写自己的对话框,我相信这是唯一的一个 - 如果有误,请纠正我.

So it depends what you mean by custom dialogs. If you just mean "not like Visual Studio" or "I need a dialog to enter something that VS doesn't offer" and you have one MSI to install, then WiX, InstallShield, Advanced Installer and other tools will do that. If you mean "I want my own completely custom C# dialogs" then you need to write your own using C# interop with MsiSetExternalUIRecord or use WiX boostrapper, which I believe is the only one out there - correct me if that's wrong.

这篇关于Visual Studio 安装程序 UI 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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