Answer the question
In order to leave comments, you need to log in
How to create a shortcut in C# (or any other .net language)?
Rather, I know how to create a shortcut via wsh. But you can't drag Interop.IWshRuntimeLibrary.dll along with you - you need the application to fit in one file. Is it possible to embed this library somehow (it didn't work through ILMerge)? Or is there any way to create a shortcut without it?
Answer the question
In order to leave comments, you need to log in
private static void configStep_addShortcutToStartupGroup()
{
using (ShellLink shortcut = new ShellLink())
{
shortcut.Target = Application.ExecutablePath;
shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
shortcut.Description = "My Shorcut Name Here";
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
shortcut.Save(STARTUP_SHORTCUT_FILEPATH);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question