|
Hi,
I have an app written in Visual studio 2008 + SP1 installed. The "Create desktop shortcut" displayed in the Manifest window but it is disabled. What do I need to do to enable it?
Thanks, |
| tlu Saturday, September 19, 2009 1:17 PM |
Have you compiled your project with .net framework 3.5.
I found that Create Shortcut checkbox is only enabledif projectis compiled with .Net Framework 3.5 - Proposed As Answer byTamer OzMVPSaturday, September 19, 2009 5:08 PM
- Marked As Answer bytlu Sunday, September 20, 2009 4:32 AM
-
|
| Tamer Oz Saturday, September 19, 2009 2:12 PM |
I don't know the reason of problem and I was not able to reproduce it ,as an alternative way you can create shortcut within code using thismethod
private void CreateShortcut(Environment.SpecialFolder f, string linkName) { IWshRuntimeLibrary.IWshShortcut sc WshShell w = new WshShell(); sc = (IWshShortcut)w.CreateShortcut(Environment.GetFolderPath(f) + linkName); sc.TargetPath = Application.ExecutablePath; sc.Description = "My First Shortcut."; sc.IconLocation = Application.StartupPath + @"\1.ico"; sc.Save(); }
I'll be alsolooking for abetter solution to your problem directly |
| Tamer Oz Saturday, September 19, 2009 2:07 PM |
Have you compiled your project with .net framework 3.5.
I found that Create Shortcut checkbox is only enabledif projectis compiled with .Net Framework 3.5 - Proposed As Answer byTamer OzMVPSaturday, September 19, 2009 5:08 PM
- Marked As Answer bytlu Sunday, September 20, 2009 4:32 AM
-
|
| Tamer Oz Saturday, September 19, 2009 2:12 PM |
Where do I execute this section if I want to do it this way?
Thanks, |
| tlu Sunday, September 20, 2009 4:35 AM |
You can write the code below to the load event of yourfirst form opens in application, or into program.cs.
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)// check if published by clickonce
{
System.Deployment.Application.ApplicationDeployment ad = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
if (ad.IsFirstRun)//is first run
{
CreateShortcut(Environment.SpecialFolder.Desktop, "My App Shortcut");
}
}
|
| Tamer Oz Sunday, September 20, 2009 4:52 AM |
You shouldn't use the code posted above. It will create a link to the exe file, and the application will not run as a ClickOnce application, which means it won't get any updates, it won't verify that the deployment hasn't been messed around with, and anything you happen to within the ApplicationDeployment namespace will not work. This article shows you exactly how to create a ClickOnce desktop shortcut programmatically. http://robindotnet.wordpress.com/2009/04/07/creating-a-desktop-shortcut-for-a-click-once-application/RobinDotNet Click here to visit my ClickOnce blog! |
| RobinDotNet Sunday, September 20, 2009 6:11 PM |
That's reallya great point.
Thanks RobinDotNet. |
| Tamer Oz Sunday, September 20, 2009 6:14 PM |
|
| RobinDotNet Sunday, September 20, 2009 9:40 PM |