简体   繁体   中英

Creating custom dialog using C# in MSI installer

We(my project team) have an existing MSI installer for a VS 2010 windows application. There is a license file we are using to validate the windows installation. We are using the standard VS setup project to do the installation.

Currently, we are using a test box in the MSI installation to get the license file path, so the user has to manually copy and paste the license file path. I want to change this by adding a 'Browse file' button that shows browse file dialog to select license file and auto populates the textbox on selecting the file.

I have used the Orca tool to modify the UI for a adding a button next to the existing textbox in the installation UI.

My question is: Is it possible to write some C# managed code to show, say the Open file dialog to select the license file and then populate the text box. I understand this is possible by writing C/C++ code. I see a lot of people using WIX toolset for creating setup files. Right now, I cannot create a new setup installer project because it involves learning WIX and I do not have the time for that now.

I don't believe it is possible.
The out-of-the-box MSI does not support managed code, and therefore you will not be able to write a managed dialog.
You can, however, write a bootstrapper to attach a custom graphic interface to your installer. It is quite complicated, though.

I know you wrote you can not convert to WIX in this stage, but I can reassure you that if you know the MSI structure well, learning it will be quite easy.
And than, you can use SharpSetup to create a C# GUI to your installer.

这是可能的(请参阅DTF之类的工具,该工具可以将.NET代码包装在非托管DLL中),但是对于调用GetOpenFileNameMsiSetProperty的自定义操作的复杂程度,我建议避免对.NET框架的额外依赖。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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