There are a few things that prevents your code from working. The temporary directory WiX property name is
Though I just added to support for
The second problem is MSI/WiX but not Wix# related. The WiX Shortcut element must be a Directory or Property identifier (not path). Thus if you have in your wxs file
This would lead to the correct wxs for both shortcuts:
This also produces correct msi table content:
![Image]()
However for some unknown reason the final result is mixed. One shortcut gets correct working dir another one doesn't:
![Image]()
Meaning that even after fixing your code the final result is not guaranteed.
Cheers
TempFoder
thus you need to encode it as below:WorkingDirectory="%TempFolder%"//or WorkingDirectory="[TempFolder]"//or WorkingDirectory="TempFolder"
%Temp%
as well and it will be available in the next release.The second problem is MSI/WiX but not Wix# related. The WiX Shortcut element must be a Directory or Property identifier (not path). Thus if you have in your wxs file
WorkingDirectory="TempFolder"
then it is exactly what you need. However there is a problem here and I will illustrate it with the code. This is a fragment from Shortcut sample that has been modified to set working directory for an application shortcut and for the exe (msiexe.exe) shortcut: new File(@"AppFiles\MyApp.exe", new FileShortcut("MyApp", "INSTALLDIR"), //INSTALLDIR is the ID of "%ProgramFiles%\My Company\My Product" new FileShortcut("MyApp", @"%Desktop%") { IconFile = @"AppFiles\Icon.ico", WorkingDirectory = "%Temp%" }), new ExeFileShortcut("Uninstall MyApp", "[System64Folder]msiexec.exe", "/x [ProductCode]") { WorkingDirectory = "%Temp%" }),
<ShortcutId="INSTALLDIR.Uninstall_MyApp"WorkingDirectory="TempFolder"Target="[System64Folder]msiexec.exe"Arguments="/x [ProductCode]"Name="Uninstall MyApp.lnk"/><ShortcutId="Shortcut.MyApp.exe.MyApp.1"WorkingDirectory="TempFolder"Directory="DesktopFolder"Name="MyApp.lnk"Icon="IconFile1_Icon.ico"IconIndex="0"/>

However for some unknown reason the final result is mixed. One shortcut gets correct working dir another one doesn't:

Meaning that even after fixing your code the final result is not guaranteed.
Cheers