简体   繁体   English

Visual Studio Installer UI集成

[英]Visual Studio Installer UI integration

Is it possible to have a custom UI for Visual Studio 2013 Installer project ( https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d )? 是否可以为Visual Studio 2013安装程序项目( https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d )创建自定义UI? What's different between setup.exe and .msi? setup.exe和.msi有什么不同? Is there a good example explaining VS Installer? 是否有一个很好的例子来解释VS安装程序?

The task is to create VS2013 like installer, which downloads the latest files from the web (URL is hardcoded). 任务是创建VS2013之类的安装程序,它从Web下载最新文件(URL是硬编码的)。 As I understand, setup.exe should get the latest .msi file from the web, download it and run it? 据我所知,setup.exe应该从网上获取最新的.msi文件,下载并运行它? Therefore, setup.exe needs to be customized somehow. 因此,需要以某种方式定制setup.exe。 Is that possible? 那可能吗?

If this extension actually has the same functionality as VS2010 installer projects, then, this sort of UI extensibility does not exist. 如果此扩展实际上具有与VS2010安装程序项目相同的功能,则此类UI扩展性不存在。

There is a very limited capability to have simple customization, but it's really very limited. 简单定制的能力非常有限,但实际上非常有限。

If you need a nice UI, then you should have a program that runs after installation to interact with the person doing the installation. 如果您需要一个漂亮的UI,那么您应该有一个在安装后运行的程序,以便与执行安装的人员进行交互。

In the VS setup world, setup.exe is a bootstrapper that installs prerequisites and then runs your MSI. 在VS设置世界中,setup.exe是一个安装先决条件然后运行MSI的引导程序。 If you have no prerequisites you don't need setup.exe. 如果您没有先决条件,则不需要setup.exe。

There are other tools that let you customize the UI - it's just that VS doesn't support that. 还有其他工具可以让您自定义UI - 只是VS不支持它。 Tools like WiX and (full) InstallShield let you build your own UI within the capabilities of MSI dialogs. 像WiX和(完​​整)InstallShield这样的工具允许您在MSI对话框的功能中构建自己的UI。 In the case where there is just one MSI file being installed that's usually all that people do. 如果只安装了一个MSI文件,那通常就是人们所做的一切。

Note that MSI dialogs are nothing to do with .NET dialogs or controls - that's why they are very basic. 请注意,MSI对话框与.NET对话框或控件无关 - 这就是它们非常基本的原因。 There's no C# in there, just the controls and dialogs that MSI supports internally. 那里没有C#,只有MSI内部支持的控件和对话框。 You don't get to use your own C# dialogs at all. 您根本不能使用自己的C#对话框。

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. 如果您要安装多个MSI文件,就好像它是单个产品(我相信SQL Server,Office,Visual Studio),那么您需要一个包装器(WiX具有Burn引导程序,InstallShield有一个chainer)来制作它看起来像一个单一的设置。 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: 如果是这种情况,或者您希望自己拥有完全自定义的C#对话框UI,那么您可以编写自己的 - 或者像这些人一样构建WiX框架:

http://www.wrightfully.com/part-1-of-writing-your-own-net-based-installer-with-wix-overview/ 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/ http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

The architecture is based on this: 该架构基于以下内容:

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

and MsiSetExternalUIRecord. 和MsiSetExternalUIRecord。 Basically you write code to install one or MSIs while Windows Installer calls back into your code for each event during the install. 基本上,您编写代码来安装一个或多个MSI,而Windows Installer在安装期间为每个事件调用代码。 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. 这是您拥有自己的启动对话框的地方,Windows Installer将回调进度消息以供您显示,以及错误,使用情况下的文件等。使用像WiX这样提供大部分框架的工具更容易那。

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. 如果您的意思是“不喜欢Visual Studio”或“我需要一个对话框来输入VS不提供的东西”并且您有一个MSI要安装,那么WiX,InstallShield,Advanced Installer和其他工具就可以做到这一点。 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. 如果你的意思是“我想要我自己的完全自定义C#对话框”,那么你需要使用C#interop和MsiSetExternalUIRecord编写自己的,或者使用WiX boostrapper,我相信这是唯一一个 - 如果那是错的,请纠正我。

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

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