We help IT Professionals succeed at work.

C# automatically creating a desktop icon during install?

Karl66 asked
Last Modified: 2010-08-05
When I distribute my C# app with the build from visual studio it creates a nice start > programs entry but no desktop icon. Of course I can manually make one but for the less knowledgeable I would prefer if it sould automatically do this. Any thoughts?

Watch Question

From your VS Setup and Deployment project, right click on it, then click View -> File System. Click on User's Desktop. Then, right click on the empty area to the right of your screen and select "Create New Shortcut". This will let you add a shortcut to the application on their desktop.

If you have any trouble finding it, just let me know!
In your setup project, look at the left side. There is a treeview called File System on Target Machine.
Click on User's Desktop.
Once User's Desktop is selected, on the right side, right click the white space and choose Create New Shortcut on the popup menu.
It is going to open a dialog.
Double click on User's Desktop.
You will see that it enables the buttons on the right side of the dialog.
Click on Add Output.
Choose your application's primary output
Click the Ok button
Now you will see that the properties window allows you to choose the Icon for the shortcut.

Hope this helps.


I am not seeing the setup project you derscribe here.

"In your setup project, look at the left side. There is a treeview called File System on Target Machine.
Click on User's Desktop."

How do I get to it?


Under Build > Publish picture viewer I dont see any options either.

I seams like you are not using a VS setup project...
If so, how are you distributing your application?
Are you using any 3rd setup tool?
If you were using the VS setup project you would be able to do what we suggested.
Ok you are using the Publish wizard.
I recommend you to add a Setup and Deployment project to your current solution.
It gives you more flexibility when creating your setup program.


How do I do that (and I am using the express version of C# VS)
You cannot create setup and deployment projects with c# express.
Also, the click once Publish wizard that you are using, doesn't allow you to create the desktop icon.
An workaround is coding your app with the necessary file access permissions so the app will create the desktop shortcut once it runs for the first time.
If you want to use such approach, please take a look at this link:
Now that I know what tools you are using, I recommend you to use a 3rd party setup tool to create a nice installation program fro your application.
You should try Inno Setup. http://www.jrsoftware.org/
It is free and is very powerful tool.


Remember that if you use that workaround, the desktop icon will not be removed when you uninstall the application, so using the free setup tool is the best option.


Cool and it works with C#?!
Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.