Create MSI and Enforce All Users with Visual Studio - visual-studio

I have created an installer using Visual Studio 2015 (with the Visual Studio installer addon). The goal is to always run the APP with the same local resources, regardless of who is logged on, therefore we target [CommonAppDataFolder] (C:\ProgramData... on Win10). The installer works just fine placing all shared resources where we want them. But the generated MSI provides the option to install as "everyone" or just the "just me"
We want to grey out the option to install as "just me".
Is there a way to do this from within Visual Studio as part of the build process for the MSI.
I see some solutions that involve running MSIEXEC with different parms eg, ALLUSERS, but I am wondering if there is a way to set this up to occur automatically in Visual Studio.
Thank you.

The project Properties window (NOT properties) can be shown by selecting the project in Solution Explorer, and then F4. You can set InstallAllUsers to True there.
The Properties window of the InstallFolder dialog has a settting InstallAllUsersVisible, so just set that to False.

I don't use that particular tool. There might be a better way to
achieve what you want than the below "hack". Adding since you got no other answers (yet).
UPDATE: Go with Phil's answer. I don't have the tool to check but it looks good. Leaving in this answer just for the record. Not recommended unless you have other things you want to change.
Post-Process MSI
Hiding Control: Not ideal, but if you don't mind post-processing the MSI (can be automated with MSI API coding) you could insert a row into the ControlCondition table to hide the whole dialog control in question.
Ad-hoc sample: Hiding the "Back" button from a setup's LicenseAgreementDlg - just add this row (I guess events defined elsewhere could show it again):
.
Dialog at runtime: Below is the actual dialog at runtime.
MSI API
To automate the above. Get hold of WiRunSQL.vbs - part of the Windows SDK - just search your SDK folder if you have Visual Studio installed. Also plenty of copies on github.
In a batch file:
cscript.exe "%~dp0"\WiRunSQL.vbs "MySetup.msi" "INSERT INTO `ControlCondition` (`Dialog_`, `Control_`, `Action`, `Condition`) VALUES ('LicenseAgreementDlg', 'Back', 'Hide', '1')"
pause
I honestly might hard code ALLUSERS=1 in the Property table as well.
Links:
SQL modification of MSI file
List tables in MSI file using VBScript
Windows Installer Scripting Examples

Related

Setting UI Level in a MSI package

I have WiX project to create a MSI package.
I want to set UI level to 3 or 4 or 5 so that it can show success/failure after the setup.
Currently it just run and vanishes.
Is there a way to set UI level on the package?
Samples: WiX Quick Start Samples.
Setup GUI: It sounds like your MSI does not have a built-in GUI at all? If so, try setting a reference to WixUIExtension.dll and define a standard WiX dialog set to use for your package - for example WixUI_Mondo. This will give your setup a sequence of "default dialogs" that are pre-made for you to apply with ease.
Procedure for Visual Studio (go here for click-by-click version):
In your WiX Visual Studio solution, open up the project list, right click "References" and click "Add Reference...". Now set a reference to: C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll (or whatever location this file is at on your box)
The file you referenced contains default GUI-sets. Now you can just inject this line into your WiX source file to have default MSI dialogs show up:
<UIRef Id="WixUI_Mondo" />
Here is a quick sample project that you can try to see this in action: https://github.com/glytzhkof/WiXDefaultDialogsSample (direct link to line in source)
UILEVEL: UILEVEL is a property setting you can use during actual installation of the MSI on end user's box (not during compilation of the source into an MSI file). The property allows you to control how much of the setup's internal GUI is visible for the end user (if there is an embedded GUI at all). You can show all dialogs, a reduced set, basic / minimal dialogs or no dialogs at all (proper silent mode).
The actual built-in MSI GUI is added during compilation as described above. UILevel does not add any GUI to an MSI without one defined internally. However, even a setup with no internal GUI defined can show a modal dialog at the end if you use this command line:
msiexec.exe /i MySetup.msi /qb+
You can also use /qn+ for "no UI, but modal completion dialog". The above is "basic UI with modal completion dialog". Msiexec.exe reference from Advanced Installer and here is the same from Microsoft Docs and from InstallShield.
Here is a dialog from an old tool to generate msiexec.exe command lines. Here you can see the different settings for UILevels:
Links:
Flexera: Tip: User Interface Levels for MSI Installations
Uninstall from Control Panel is different from Remove from .msi (on UILevel and differences between silent and interactive installation)
Knowing the Mode of Installation

Why is the autorun information by the startup shortcut created by InstallSheild incorrect?

I have an InstallShield 2013 project that puts a shortcut into the Startup folder. When I run the installer, the shortcut is placed correctly and seems to have the correct path information. All seems well.
Then I look at the startup information provided by the windows task manager. The startup entry reads.
Name: InstallShield
Publisher: Flexera Software LLC
When using the right click "Open File Location", the path opened is not the path of the generated shortcut. Instead, it is C:\Windows\Installer{GUID}\NewShortcut2_{HexString}.exe
Why is this happening, and how do I change it?
Edit: The testing has been done on a windows 8.1 system.
Per the requirements of the Icon table (see the Remarks section), InstallShield creates an exe format file that includes the icon for your shortcut. This is the file placed in the location you mention above. However it is not the target of the shortcut, so I do not understand why Windows is indicating this. I don't think InstallShield offers any ways to tweak how it builds the Icon table, unless it does things differently for advertised and non-advertised shortcuts.
(BTW, I suspect this behavior is specific to certain versions of Windows, so it may be worth editing that into your question.)

How can I add an optional UI to WiX toolset

I have already made a quiet installer (without the need to click any buttons but some progress bar is shown while installation is in progress) for a project deployment. This time I wish to add an optional graphical user interface.
By default, the installer should just run without clicking anything, when a parameter is given, let's say, the msiexec parameter: /qf, the installer would pop up an interface that can be interacted with.
I've already added the required UI dll to the project reference, but given msiexec /i C:\Setup.msi /qf, it doesn't work. How can I get it to work?
Did you try the procedure described in this well known Wix tutorial?
At its simplest level, this means that you essentially just add this to the Wix source file and you get a default GUI:
<UIRef Id="WixUI_Minimal" />
You can also try the other "defaults":
WixUI_Mondo (normal)
WixUI_FeatureTree
WixUI_InstallDir
WixUI_Advanced
A search turned up a similar answer, and one talking about extending the default gui.
Just modify the WixUI_Minimal.wxs file:
How to build a minimal WiX installer UI without a license page?
WiX toolset WixUI_Minimal Dialog Set
Customised UI's for WiX
Then use properties to condition the dialogs to show or hide as you launch the MSI via msiexec.exe.

Change pre-defined message in Windows installer using VS 2010

I have looked at this question, but it is something different.
I need to change the message of MsiRMFilesInUse Dialog box.
Currently the message is "Do not close applications. (A reboot will be required.)"
I need to get it changed to "Do not close applications. (Application may not work)" .
The message comes when application is open, and user try to uninstall the app.
The only (but big) restriction is to do it in Visual Studio 2010 setup project. (Installshield/Wix are not allowed).
I have looked at custom action, not able to figure out how to change the message.
Another approach is to create a custom dialog box, but then i am not able to change the dialog box somehow. Also new dialog box has a very limited set of controls.
Per MsiRMFilesInUse Dialog (Windows)
The MsiRMFilesInUse Dialog box can be authored to display a list of
processes that are currently running files that need to be overwritten
or deleted by the installation. The user can select between options to
"Automatically close applications and restart them" or "Do not close
applications. (A reboot will be required.)" If the user selects the
"Automatically close applications and restart them" option, a push
button control on this dialog box can be authored to publish the
RMShutdownAndRestart control event and the Restart Manager can close
the applications and restart them at the end of the installation. This
can eliminate or reduce the need to restart the computer. For more
information, see System Reboots.
Notice the generous use of the word "can be authored". It is written this way because the perspective is of the Windows Installer SDK (Windows Platform). InstallShield (Basic MSI) and WiX (UI Extension) both author this table. Visual Studio Deployment Projects do not because Microsoft (DevDiv) never put the effort in to support it. You can't modify what isn't there.
Now if you are a Windows Installer expert ( which I doubt otherwise you wouldn't even be posting this question ) there are things that can be done. You can write postbuild commands to modify the built MSI to perform SQL updates and/or apply transforms to inject a custom authored dialog into your MSI after VS is done building it.
I've been down this road, I know how to do it. I also know how counterproductive it is as you'll find yourself doing it ALOT to make up for the short comings of the tool. At that point you understand why WiX / InstallShield is needed and move on.
And for the record, I once quit a very well paying job because VDPROJ is all the development managers would allow. I also returned a couple years later for even more $$$$ when they finally realized that they didn't know what they were talking about.
Good luck.

Customizing Repair option in MSI

I have a Visual Studio Setup Project that is very basic except for one modification. I have two different libraries that I would like installed based on the user's selection. I added a checkbox screen and conditions to the files. They can install either component or both components. This all works fine.
Now for my requirement. Let's say that the user installed the MSI and selected only one component. Now, they need to install the second component from the same MSI. If they run the MSI again, I get the option to repair or remove. Repair will only fix the component that was installed originally. How can I give them the option to install the other components by showing the checkbox screen again?
If this functionality isn't available in a VS Setup Project, is there something else where it is? WiX perhaps?
I don't think VS Setup projects support this. Wix or MSI's created from other tools like Installshield can support this. The usual way to handle this would be to create separate features and assign the different components to each feature. Then if the MSI is built using WiX or some other tool, from add/remove there will be the Change button/option through which you can get the option to repair, modify, or uninstall. Modify then lets you change your feature selections without doing a reinstall.
You need to use the free MSI editors like ORCA or SuperORCA. Microsoft use to provide ORCA tool in their service pack. Not sure if they are continuing so. SuperORCA tool you can find at http://www.pantaray.com/msi_super_orca.html. Now when I had similar task to achieve following was my approach. I used SuperOrca to open my MSI file.
1] On repair/remove MSI dialog screen, add one more radiobutton for "Modify" - In SuperOrca-->Under RadioButton table --> Add entry for Modify radiobutton
2] Rename BackButton's text to "Reinstall" from its original "Back" --> In SuperOrca-->under Control table --> change Text property to rename Back to Reinstall
3] On selection of Repair/Remove radio button enable Finish button and disable Reinstall button. On select of modify radio button enable Reinstall button and disable Finish button - In SuperOrca--> Under ControlCondition table --> add entries for enable/disable "Reinstall" and "Finish" buttons for each comibinations for repair/remove screen (In my case dialog form name is "MaintananceForm")
4] Now from SuperOrca tools ControlEvent table find out conrol name for BackButton, In my case it is "PreviousButton". Now modify its Event, Argument & Condition entries from the table. And the values for these properties must be the same for the "Next" button properties from the Welcome screen of MSI file which redirects user to show installation options to choose.
Note: This is working fine for me. But when you re-select installation options again and click Next, somehow it does not forced for installing the selected option. Instead it repairs the MSI. I tried deleting entries from Windows\Installer folder so that MSI will not pick cashed installed version but no luck. If anybody is having answer on how to forced MSI to re-install through MSI setup wizard please let me know.

Resources