I have an installer that will install the following shortcuts. The shortcuts are supposed to be installed in the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyAPPFolder . But the issue is that a temporary shortcut will also create in the Start Menu and if I click on that the shortcut will disappear. I don't want the shortcut to be appear in the Start menu and want it to appear only in MyAPPFolder and should uninstall everything while uninstalling the installer. Also if i remove the Advertise=yes from my code this issue won't come but this time the shortcuts won't get uninstalled correctly.
ProgramMenu
MyAPPFolder
Shortcut1Advertise
Shortcut2Advertise
Shortcut3Advertise
Shortcut3Advertise
enter
The code for installling the shortcut is given below.
<ComponentGroup Id="Shortcuts_Component_Group1" Directory="test">
<Component Id="cmpShortcuts1" Guid="{0CD394A2-1D7B-44A0-A85A-EC17E2816BDD}">
<File Id="File1" Name="File.test" KeyPath="yes" Vital="no" DiskId="1" Source="$(var.Test_File_Path)File.test" >
<Shortcut Id="Shortcut1Advertiseid" Directory="MyAPPFolder" Name="Shortcut1Advertise" ShortName="Test1" Description="Shortcut1Advertise" Arguments="/x test1" Icon="test.ico" WorkingDirectory="test" Advertise="yes"/>
<Shortcut Id="Shortcut2Advertiseid" Directory="MyAPPFolder" Name="Shortcut2Advertise" ShortName="Test2" Description="Shortcut2Advertise" Arguments="/x test2" Icon="test.ico" WorkingDirectory="test" Advertise="yes"/>
</File>
</Component>
<Component Id="cmpShortcuts2" Guid="F9032ED8-2F25-4852-B437-38AE61EE7F57">
<File Id="File2" Name="File2.test" KeyPath="yes" Vital="no" DiskId="1" Source="$(var.test_File_Path)\File2.test">
<Shortcut Id="Shortcut3Advertiseid" Directory="MyAPPFolder" Name="Shortcut3Advertise" ShortName="Test1" Description="Shortcut3Advertise" Arguments="/x test3" Icon="test.ico" WorkingDirectory="test" Advertise="yes"/>
<Shortcut Id="Shortcut1Advertiseid" Directory="MyAPPFolder" Name="Shortcut4Advertise" ShortName="Test1" Description="Shortcut4Advertise" Arguments="/x test4" Icon="test.ico" WorkingDirectory="test" Advertise="yes"/>
</File>
</Component>
</ComponentGroup>
Related
I'm looking for a way to add an icon to the start menu application folder using Wix. I already know how to add icons for shortcuts but the application folder doesn't appear to be a shortcut. Any help would be appreciated. Thanks.
Since you haven't shared any code, there is an example
<Component Id="MainAppFile" Guid="*">
<File Id="MainAppExecutable" Source="$(var.AppDir)$(var.AppFile)" KeyPath="yes">
<Shortcut Id="StartMenuAppShortcut"
Name="$(var.ProductName)"
Advertise="yes"
Directory="ApplicationProgramsFolder"
WorkingDirectory="INSTALLLOCATION">
<Icon Id="StartMenuIcon.ico" SourceFile="..\icon.ico"/>
</Shortcut>
<Shortcut Id="DesktopAppShortcut"
Name="$(var.ProductName)"
Advertise="yes"
Directory="DesktopFolder"
WorkingDirectory="INSTALLLOCATION" >
<Icon Id="DesktopIcon.ico" SourceFile="..\icon.ico"/>
</Shortcut>
</File>
<RemoveFolder Id="CleanupAppShortcut" Directory="ApplicationProgramsFolder" On="uninstall"/>
</Component>
I'm learning about shortcuts in Wix and have managed to create shortcuts on the desktop.
If I delete the shortcut and then run the installer again I would like the shortcut to be created again.
How can this behavior be achieved with Wix?
I have created shortcuts both with
<File Id="TestX.exe" Name="TestX.exe" Source="$(var.TestX_TargetDir)TestX.exe">
<Shortcut Id="desktopIcon" Directory="DesktopFolder" Name="TestX" WorkingDirectory='INSTALLFOLDER' Icon="IconTestX.exe" IconIndex="0" Advertise="yes" />
</File>
and
<Fragment>
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut"
Guid="1E0D1741-57F0-4E22-89FC-4A189E2BB7E0">
<Shortcut Id="desktopSC"
Name="MyProduct"
Description="MyProduct description"
Target="[INSTALLFOLDER]TestX.exe"
Icon="IconTestX.exe">
</Shortcut>
<RemoveFolder Id="RemoveDesktopFolder"
Directory="DesktopFolder"
On="uninstall" />
<RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
I solved this problem by using WixUI_InstallDir in the WixUI library, which added a GUI which includes the option to start a repair.
Links about the WixUI dialog library:
http://wixtoolset.org/documentation/manual/v3/wixui/wixui_dialog_library.html
http://wixtoolset.org/documentation/manual/v3/wixui/dialog_reference/wixui_installdir.html
I want to set the shortcut target path in wix for an advertised shortcut
This is the code that creates the shorcut now:
<Component Id="APP_EXE" Directory="INSTALLDIR" DiskId="1" Guid="XXXX-XXXX">
<File Id="AppExe" Name="app.exe" Source="$(var.ComponentSourceDir)\$(var.ExeName)" KeyPath="yes">
<Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder" Name="$(var.VersionedName)" WorkingDirectory="INSTALLDIR" Icon="MainIcon.exe" IconIndex="0" />
</File>
</Component>
The target in shortcut properties window is readonly now and it displayes the application name. I cannot change it.
I created a new component where I create the shortcut. I removed the previous one.
<Component Id="APP_EXE" Directory="INSTALLDIR" DiskId="1" Guid="XXXX-XXXX">
<File Id="AppExe" Name="app.exe" Source="$(var.ComponentSourceDir)\$(var.ExeName)" KeyPath="yes">
</File>
</Component>
<Component Id="APP_SHORTCUT" Directory="INSTALLDIR" DiskId="1" Guid="XXXX_XXXXX">
<RegistryValue Root="HKCU" Key="Software\APP\Installer" Name="desktopShortcut" Value="KeyPath" KeyPath="yes" Type="string" />
<Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="$(var.VersionedName)" WorkingDirectory="INSTALLDIR" Icon="MainIcon.exe" IconIndex="0" Target="[INSTALLDIR]app.exe"/>
</Component>
I am working with WiX from last 5 month with no issues. Recently, i am in need to have "StartIn" property in App Desktop shortcut. By default, its empty.
Here is my full Installer code.
I am working with below code:
<Component Id="myapplication.EXE" DiskId="1" Guid="*">
<File Id="myapplication.EXE" Name="My Application.exe"
Source="D:\My Application\My Application.exe">
<Shortcut Id="desktopShortcut" Directory="DesktopFolder"
Name="My Application" WorkingDirectory="INSTALLDIR"
Icon="DesktopIcon.exe" IconIndex="0"
Description="My Application Description" />
<Shortcut Id="ExeShortcut" Directory="ProgramMenuDir"
Name="My Application" Icon="StartMenuIcon.exe" IconIndex="0" />
</File>
</Component>
But didn't work.
I have also tried adding "Target" property:
<Shortcut Target= "INSTALLDIR" Id="desktopShortcut" Directory="DesktopFolder"
Name="Virtual Sim Center Beta" WorkingDirectory="INSTALLDIR"
Icon="DesktopIcon.exe" IconIndex="0"
Description="My Application Description" />
but getting error message:
The Shortcut/#Target attribute cannot be specified when the Shortcut
element is nested underneath a File element.
This script bellow is working for my WIX:
....
<!-- Desktop Menu -->
<DirectoryRef Id="DesktopFolder">
<Component Id="FooDesktopShortcutMenu" Guid="*">
<Shortcut Id="FooApplicationDesktopShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"
Directory="DesktopFolder"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
....
<!-- Tell Wix -->
<Feature Id="ProductFeature" Title="FooSetup" Level="1">
.....
<ComponentRef Id="FooDesktopShortcutMenu"/>
.....
</Feature>
.....
Glytzhkof is right and so is your WiX source - just put it under the Component.
In addition to the answer by #Adiono check whether the 'WorkingDirectory' folder actually contains the 'Target'.
The 'Start in' of my shortcut was blank even when both 'WorkingDirectory' and 'Target' had valid values, but the 'Target' was not present in the 'WorkingDirectory'.
I don't have Wix set up to try this, but you can try to move the Shortcut element up to be nested under the Component element and not the File element. Then set the WorkingFolder attribute. Try something like this.
WIX documentatino on Shortcut element says about Target attribute:
The value will be defaulted to the parent File when nested under a File element.
But the code
<Component Guid="MY_GUID" Id="MyAppComponent">
<File Source="SomeDll.dll" Name="SomeDll.dll" Id="SomeDll.dll" KeyPath="yes" />
<File Source="MyDll.exe" Name="MyDll.exe" Id="MyDll.exe" />
<Shortcut Id="MyApp.Shortcut" Directory="ApplicationProgramMenuDir" WorkingDirectory="INSTALLDIR" Name="MyApp" Icon="ProgramIcon.ico" Advertise="yes" />
</File>
</Component>
does not work as expected - shortcut points to dll file and running it shows Windwos error message that it can't launch file with dll extention.
To fix that we need to make the only difference: set KeyPath="yes" attribute for exe file instead of dll:
<Component Guid="MY_GUID" Id="MyAppComponent">
<File Source="SomeDll.dll" Name="SomeDll.dll" Id="SomeDll.dll"/>
<File Source="MyDll.exe" Name="MyDll.exe" Id="MyDll.exe" KeyPath="yes" />
<Shortcut Id="MyApp.Shortcut" Directory="ApplicationProgramMenuDir" WorkingDirectory="INSTALLDIR" Name="MyApp" Icon="ProgramIcon.ico" Advertise="yes" />
</File>
</Component>
So WIX documentation contains mistake? Target is set not to the parent File element, but to the ancestor's Component's KeyPath?
Or is it my mistake and something wrong with my code?
Try to add a <RegistryValue> tag like this:
<Component Guid="MY_GUID" Id="MyAppComponent">
<File Source="SomeDll.dll" Name="SomeDll.dll" Id="SomeDll.dll"/>
<File Source="MyDll.exe" Name="MyDll.exe" Id="MyDll.exe" KeyPath="yes" />
<Shortcut Id="MyApp.Shortcut" Directory="ApplicationProgramMenuDir" WorkingDirectory="INSTALLDIR" Name="MyApp" Icon="ProgramIcon.ico" Advertise="yes" />
</File>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\setup" Name="Shortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>
If your InstallScope is perUser, using HKCU
If your InstallScope is perMachine, using HKLM