C# custom action windows form focused issue - c#

Background:
I used Visual Studio setup project to deploy one of C# application to client windows server.
While installing the application I need to setup a scheduled task in the server as well
For this I used a Custom Action feature in the setup project. What I did is created a windows form with input fields and "ok" button and once user enter values and click on the "ok" button task will be created. I added this custom task in Install and Commit steps in Custom Action.
Issue
: Everything works fine but when the created windows from shows, it lost the focuses even I used showDialog method to show the form. So always main setup window will active and users not see the popup form in background (see the attached image).But I can click on the popup window and make it activate. I tried with SetActiveWindow method also but no good result so far.
Simple what I need is to activate the popup window untill user action (default showDialog behavior). So here I'm looking for any help.

If you want to get user input using custom UI during the MSI deployment best approach is to create the .wid extension files. this is the type of UI files that you see during the MSI installation(where you select the installation path etc). Enough though visual studio doesn't have features to create these UI files there are Microsoft tools you can use to create these files. One of the best tool is Orac.
Orac.exe
How to use the Orca database editor to edit Windows Installer files
Once you create the UI file, you have to place the file under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\Deployment\VsdDialogs\1033 (it's where MSI picks the default UI files from)
After that you should be able to select your custom UI and inject it during any phase of installation cycle(beforeinstall, install, afterinstall etc). Then you can pass the value user has entered into the text field as a argument for installer class. Then you can read the value within the installer class using context parameter.
string value = Context.Parameters["ParameterName"];

Related

How to customize the Setup wizard with custom forms in Visual Studio setup project

I have to create a setup project with custom serial key validation. I have to proceed the installation only after the serial key is authenticated or else we have to skip the installation.
I have tried the sample setup project, and have called the custom form for authenticating serial key in the installer class, merged the installer class from the custom action in the setup project.
But the Serial key validation form comes after the progress form executes.
I need to show it after the welcome page.
I have attached the screenshot of the setup wizard.
How to bring the Setp 5 form (custom form) before Step 2?
This can't be done in Visual Studio setups - the only validation supplied is the serial number template, a masked edit control to verify the basics. This is because Visual Studio setups custom actions all run after the files are installed, and you cannot associate one with a button click to validate the serial number, or in fact anything in the UI.
You might need to use another tool for your setup. VS setups are pretty simple but they don't have many features. Otherwise you could use another tool to build a merge module that you could add. Manually editing the MSI file is a possibility but you'd need to know a lot about the internals of MSI files.

Creating Custom installer in visual studio that allows separate installation for Client and Server

I have been planning to create a installer using the "Setup Project" included in visual studio. I want to create this in such a manner that it allows separate Client/Service installation using a single MSI file.
Can anyone guide me the right direction/Steps to follow.
To elaborate it a bit more the client application will be a desktop application and the server app will be windows service.
In general, you add a RadioButtons (2) dialog to your setup from the canned list, and make the user choose one, or checkboxes if both are allowed. If it's radio buttons, there's a property BUTTON2 which will be 1 or 0 depending on which was selected. Then each file for client or server you set a condition BUTTON2=1 as appropriate.
There are some nasty gotchas. One is that a repair will go through reinstall and the value of BUTTON2 will be undefined so you'll get unexpected results. One way to deal with this is to create a registry item with the value [BUTTON2] so that the value is saved in the registry, then you can add a search for that value to re-initialize it in case of repair.
VS setups don't have a good way of doing this because they don't have multiple features that you can choose from, and that can be modified by going into Programs&Features and changing them. VS setups all have a single feature, so all you can do is condition the files/components being installed based on checkboxes and radio buttons.
The properties window of every file being installed (Solution Explorer pane) includes a Condition property. Selecting the file in Solution Explorer then doing F4 shows the properties window.

How to add additional custom window to VS setup projects UI flow

I'm using a VS 2008 setup project to deploy my application to client computer.
Now I need to add custom UI Window to get some information form user for set up process.
As example, there should be a form to enter user information after click next button of the destination folder search window.
How can I do this?
If you want to get user input using custom UI during the MSI deployment best approach is to create the .wid extension files. this is the type of UI files that you see during the MSI installation(where you select the installation path etc). Even though visual studio doesn't have features to create these UI files there are Microsoft tools you can use to create these files. One of the best tool is Orca.
Orac.exe
How to use the Orca database editor to edit Windows Installer
files
Once you create the UI file, you have to place the file under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\Deployment\VsdDialogs\1033 (it's where MSI picks the default UI files from)
After that you should be able to select your custom UI and inject it during any phase of installation cycle(beforeinstall, install, afterinstall etc). Then you can pass the value user has entered into the text field as a argument for installer class. Then you can read the value within the installer class using context parameter.
string value = Context.Parameters["ParameterName"];

How to customise the dialogs that a user sees when she runs my windows forms setup project?

I have to create a setup project for my windows form application and I want to change the default computer picture(it contains a monitor placed on a CPU along with a keyboard, mouse, CD and has purple background) which appears in the top right corner of all of the installation screens. I want to replace it with bmp image which we have created. What is the procedure to do this? Please note that I am working on .Net 2.0, visual studio 2005. Thanks.
With the Setup project selected, use View + Editor and click "User Interface". You'll see a tree view of the dialogs that the user sees when she runs the installer. Standard steps are Welcome, Installation Folder, Confirm Installation, Progress and Finished.
Select one of those steps and look in the Properties window. Note the BannerBitmap property. Change it from (Default) to your own custom bitmap.

How to execute custom action before installing files when using VS's Setup Project?

I have a simple VS setup project. On the first screen user inputs database name and credentials to access it. Then user clicks 'Next' button and files are copied.
I would like to add one check which should be executed after user typed database name and credentials, but before copying files. This check should hit the database and verify some info. And depending on the result of this check installation will be continued or interrupted.
How could i do it? Is it possible to do it using VS setup project?
Thanks
I've figured out that it is impossible to execute custom action before installing files using VS's setup project. This is because VS's setup project copies files at first and after that executes custom actions. This is by design.
That's why I decided to create a small winforms application with setup's interface and required behavior.

Categories