Problem: I have a visual studio solution with a visual studio setup project. During the installation of the msi package, I want a shortcut to be created in the startup folder, so that my application can automatically start when the user logs in.
Action Taken:
I followed this : How to create an installer project in VS2019 for a Windows form application
and this
Visual Studio Deployment Project - Create shortcut to deployed executable
This question must not be considered as duplicate as these steps are not working for me, they endup with a corrupted shortcut. The shortcut gets created but is not working:
The application deploys correctly and the link gets created but it does not point to the executable. If you look at the picture below, you'll see That Target is greyed out and "points" to a folder. It should mention the executable name.
If I create a shortcut manually, you can see the difference (Target is properly filled)
Steps to reproduce:
- Right click setup then view File System
- Right click File System on Target Machine, then Add Special Folder / User's Startup folder
- On the right panel of Application Folder, I right click Primary Output of FormAgent and Create Shortcut to Primary Output
- I drag and drop the shortcut to User's Startup Folder and rename it appropriately.
Result: Shortcut gets created in the startup folder but is corrupted.
Troubleshooting done:
I wanted to create a shortcut to FormAgent.exe instead of a shortcut to Primary Output. But nowhere in the GUI I found a place to select anything else than Primary Output. Every single GUI is proposing Primary output from ProjectName and nothing else.
See the below picture which is the Properties of the shortcut: In the properties, if I click on Target, it points to Primary Output with no possibility to select an executable. (Add File is adding an external file to the setup project).
As additional troubleshooting, I went back to Application Folder and edited the properties of Primary Output, then clicked on Output: The output displays 2 files and I wonder if this could be the cause of my problem. ( What is a result of a shortcut to an output that has 2 files?)