I'm in Windows 7 working on combining two apps with the same task bar icon, as described in this question:
Pinning advertised shortcuts on the taskbar in windows 7
I see there, and it lots of online documentation that I need to set the AppUserModelID as a property of the shortcut. My installer program uses the basic Visual Studio 2008 setup project, and I don't see any way to set shortcut properties on installation. Is there any head-start anyone can give me on how to do this?
Sheng commented that "You can also switch to other MSI authoring tools that supports setting the appid for shortcuts, such as WIX or NSIS."
To achieve this using a Shortcut element in Wix you must add a child ShortcutProperty element to your Shortcut element and use the Shell property name "System.AppUserModel.ID" as the key.
<Shortcut Id="StartMenuShortcut"
Name="Shortcut Name"
Description="Shortcut Description"
Target="[INSTALLLOCATION]Application.exe"
WorkingDirectory="INSTALLLOCATION">
<ShortcutProperty Key="System.AppUserModel.ID" Value="AppUserModelID" />
</Shortcut>
I don't know anything about VS2k8 setup projects so I don't know if you can run custom actions etc but I do know that to set the AppId on a shortcut you load/create your shortcut and query its IShellLink for IPropertyStore, then InitPropVariantFromString a variant with your id and call SetValue(PKEY_AppUserModel_ID,propvariant) + Commit on the propertystore
Adding to Ander's reply.
Visual Studio Setup project does not support setting appid and will probably never be unless Microsoft reverse the deprecation of Setup project feature.
There is a Windows API Code Pack that helps in invoking shell APIs. Here is a tutorial on creating shortcut in custom action. You can add the code to update the shortcut to the custom action.
You can also switch to other MSI authoring tools that supports setting the appid for shortcuts, such as WIX or NSIS.
Related
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
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.)
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.
I search the web a lot when writing code. When working in Visual Studio 2008, every time I hit the keyboard's Web Home key (you know the one on every multi media keyboard with the house on it) it opens a browser in VisualStudio - usually to something on MSDN.
Not that I don't like MSDN, but I'd like to open a real browser on my second monitor and go to my home page. Is there a way to tell Visual Studio not to open it's own home page and instead let Windows process it?
You can bypass Visual Studio processing this key by means of the excellent free utility AutoHotkey. It can help with all sorts of automation needs, but in particular Overriding or Disabling Hotkeys of course, see the list of Hotkeys (Mouse, Joystick and Keyboard Shortcuts) too.
Your scenario requires Context-sensitive Hotkeys; the necessary parameters to discriminate target applications via Window class and/or title can be determined via the included Window Spy utility.
While I'm working on a laptop right now, which doesn't feature a Browser Home key, I just tested the following script fragment successfully with another keyboard shortcut:
#IfWinActive ahk_class wndclass_desked_gsk ; Visual Studio browser home key hook
Browser_Home::Run firefox.exe http://example.com
#IfWinActive ; Subsequent mappings/hotkeys in effect for all windows again now
I usually start one keyboard shortcut related script (incidentally called Windowskey.ahk) automatically via my user Start Menu\Programs\Startup folder, and launch other scripts from there via a hotkey as needed ;)
Is there not a way in the visual studio shortcuts to disable the home button?
Does it do that when Visual Studio is not open? If so, check your file associations.
Did your keyboard have an utility to associate the key? Maybe launching the browser directly will avoid your problem
Tools/Options
Environment/Keyboard
In the list, Find View/Home, and assign it to a very complex shortcut keys combination.
Also do the same for View/StartPage and View/WebBrowser
Keyboard shortcuts for the multimedia keys can be customized using something like TweakUI. I think you'd have to modify the Home action for the keyboard, not a Visual Studio shortcut.
'Regular' windows application shortcuts have a target which is a path to an executable file. This path is visible (and editable) in the shortcut's properties dialog.
But many shortcuts have no such path, only a (read only) application name is displayed. All the MS Office programs, for example, have such shortcuts.
How do these shortcuts work (I guess there's a progid involved), what are their advantages over 'regular' shortcuts and why would I want to use such shortcuts for my own applications?
Finally, can I create such a shortcut with an installer built by a Setup Project in Visual Studio 2008?
These are "advertised" shortcuts provided by MSI.
Here's a google search that contains some information you might find useful:
Google Search
I don't know if you can create these via a Setup Project.
One advantage of advertised shortcuts is you can have certain features be installed on demand, and I think missing files can also be repaired if I'm not mistaken. The downside as a user that I hate is I sometimes want to find out where the executable is and which executable is run and it's harder to find that out.
Read MSDN, everything is detailed about Links.