I am trying to create a shortcut in the common startup folder so when any user logs on my application is run. I am using the nuget package WinSharp version 1.0.36.2 to create an MSI installer.
Below is my Main from the WinSharp project. The idea is to install the app to program files and create a shortcut in the startup folder (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp). The commented out line that creates a shortcut on the desktop works fine. Building the current version gives the error:
Error ICE38: Component StartupFolder.EmptyDirectory installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.
Is there a different directory Id like Desktop that will work for the startup folder?
var project = new ManagedProject("Plate Synthesis Listener Setup",
new Dir(@"%ProgramFiles%\myCompany/myApp",
new File(@"..\myApp\bin\Debug\myApp.exe")
{
//Shortcuts = new[] {new FileShortcut("myApp", "%Desktop%")}
Shortcuts = new[] {new FileShortcut("myApp", "StartupFolder")}
},
new Files(@"..\myApp\bin\Debug\*.dll"),
new File(@"..\myApp\bin\Debug\myApp.exe.config")
{
GUID = new Guid("My new GUID"),
ManagedUI = ManagedUI.Empty,
Version = new Version(1, 0, 1)
};
project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
.Add(Dialogs.Progress)
.Add(Dialogs.Exit);
project.BuildMsi();
Other threads I have seen but are for XML not C#:
Wix create shortcut in user startup folder
How to : Making a program start on Windows startup with wix toolset?