|
Greetings all.... I have been using the click-once update procedure with my application for some time now, and all has been well until lately. Now whenever the user accepts the update, it removes the desktop icon and sets the Start Menu option as a "new software installed". I have looked at all the options and settings, and I cannot see anything that would cause this behavior. Any clues on what might be causing the update procedure to remove the desktop shortcut and reset the application status?
Thanks for any guidance or suggestions you can offer!
LDC- Changed TypeMartin Xie - MSFTMSFTThursday, February 19, 2009 7:10 AMRedirect to ClickOnce and Setup & Deployment Projects forum for better support.
- Changed TypeLyleD Sunday, February 22, 2009 4:09 PM
- Moved byMartin Xie - MSFTMSFTFriday, March 06, 2009 8:49 AMMove it. (Moved from Visual Basic IDE to ClickOnce and Setup & Deployment Projects)
-
| | LyleD Friday, February 13, 2009 2:31 PM | Here you go. This gets info from the assembly, which in our case matches the product name and company name. There's probablya simpler way to do this, but this works for me. It basically copies the shortcut from the start menu to the desktop.
/// <summary> /// This will create a Application Reference file on the users desktop /// if they do not already have one when the program is loaded. /// Check for them running the deployed version before doing this, /// so it doesn't kick it when you're running it from Visual Studio. /// </summary static void CheckForShortcut() { if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; if (ad.IsFirstRun) //first time user has run the app { Assembly code = Assembly.GetExecutingAssembly(); string company = string.Empty; string description = string.Empty; if (Attribute.IsDefined(code, typeof(AssemblyCompanyAttribute))) { AssemblyCompanyAttribute ascompany = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyCompanyAttribute)); company = ascompany.Company; } if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute))) { AssemblyDescriptionAttribute asdescription = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyDescriptionAttribute)); description = asdescription.Description; } if (company != string.Empty && description != string.Empty) { string desktopPath = string.Empty; desktopPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "\\", description, ".appref-ms"); string shortcutName = string.Empty; shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", company, "\\", description, ".appref-ms"); System.IO.File.Copy(shortcutName, desktopPath,true); } } } }
Ts'i mahnu uterna ot twan ot geifur hingts uto.- Proposed As Answer byMrBlue13 Tuesday, March 24, 2009 11:36 PM
- Marked As Answer byLyleD Wednesday, March 25, 2009 11:37 AM
-
| | RobinDotNet Tuesday, March 24, 2009 6:52 PM |
Greetings all.... I have been using the click-once update procedure with my application for some time now, and all has been well until lately. Now whenever the user accepts the update, it removes the desktop icon and sets the Start Menu option as a "new software installed". I have looked at all the options and settings, and I cannot see anything that would cause this behavior. Any clues on what might be causing the update procedure to remove the desktop shortcut and reset the application status?
HiLyleD,
Welcome to MSDN forums!
1.How tocreate Desktop Shortcutvia ClickOnce Deployment? If your project targets .Net Framework 3.5, and .Net Framework 3.5 SP1 has been installed, then you can create desktop shortcut for your application via ClickOnce deployment.
Go to Project menu -> Properties�-> Publish tab -> Options�button-> Manifests entry -> Check the "Create desktop shortcut" option

2. ClickOnce Deployment will create such Program Group menu shortcut: "Publisher name" -> "Product name" under Start menu -> All programes.
We can change “Publisher name�and “Product name�to what you expect like this:
Project Properties -> Publish tab -> "Options..." button
3. The "updates" button under Project Properties -> Publish tab is for choosing the update strategy. Ifthe new version of the application is available, it will bedownloaded and run (publish again, thus overwrite configuration info). Thedesktop shortcut and Start Menu settings are based on ClickOnce configuration as described above. If you ever manually changed or adjusteddesktop shortcut or Start Menu settings, I think they will be resetwhen ClickOnce updates.
Choosing a ClickOnce Update Strategy:http://msdn.microsoft.com/en-us/library/s22azw1e.aspx
You can get better support at the forum: Windows Forms>ClickOnce and Setup & Deployment Projects
You can submit your suggestions or feedback to Microsoft Connect feedback portal. http://connect.microsoft.com/VisualStudio/
Best regards, Martin Xie
| | Martin Xie - MSFT Thursday, February 19, 2009 7:09 AM | This does not address the question I posed, does it..... yes, this is useful information, but does not respond to the original inquiry. LDC | | LyleD Sunday, February 22, 2009 4:07 PM | Hi, I tried to create a simple Console application, deploy it via ClickOnce setting a desktop shortcut, making the application available both on-line and on-line; I installed the application, then I published a new version and, when prompted, the application was automatically updated.
But the desktop shortcut was not removed and everything is working correctly to me. Could you please provide some more information about how deployment properties were set, so that I can try to repro the problem?
Thanks Alessandro Del Sole - Microsoft MVP
http://community.visual-basic.it/Alessandro | | Alessandro Del Sole [MVP] Sunday, February 22, 2009 9:48 PM | I have the exact same problem. Until about a month ago, we didn't have any problems at all. But now whenever we send out an update (it checks for updates on startup) and the users runs the application (installing the update) the desktop icon is automatically removed (and the shortcuts in programs under Start menu is marked as newly installed)
So far the only solution we could find was to copy the shortcut from one of the users (not Administrator) to all users desktop, then the user will not be allowed to delete the shortcut when an update is being installed. But this requires us to log in as an administrator on all machines (with several hundred pc's this is not an easy task, so we hope to find a better solution)
Using .Net framework 3.5 is not an option at the moment
| | Adagio1 Wednesday, March 04, 2009 9:23 AM | Here's the steps I took to recreate the problem:
Created a new Windows form application Under Advanced Compile Options I set it to use .Net Framework 2.0 Under Publish \ Prereq. I set it to automatically install .Net Framework 2.0 Set the application to check for updates during startup Publish After installation I copied the shortcut to the desktop Publish update Start the application... voila, shortcut gone | | Adagio1 Wednesday, March 04, 2009 9:58 AM | The "solution" I came up with is to drag and drop the shortcut into the top left section of the Start menu. Granted, this does nothing to address the question as to WHY the shortcut is disappearing now -- maybe a Windows update that ran? -- but it does stop my end users from calling to say that their program is gone.
I would like to learn what is making the shortcut vanish from the desktop, though, and why the install gets flagged as a "new program." LDC | | LyleD Wednesday, March 04, 2009 12:31 PM | I don't know why it's flagging it as a new program, but you can programmatically create the desktop shortcut. We're doing that, and we're using .Net 2.0. Would that code be helpful to you?
RobinS. GoldMail.com Ts'i mahnu uterna ot twan ot geifur hingts uto. | | RobinDotNet Thursday, March 19, 2009 5:45 PM | Actually the "Project manager" decided he wanted to go a different way from ClickOnce deployment to a Group Policy installation, so I had to redesign the architecture. But like my momma always said, never turn down a free meal or free code! I'd love to see what you've got.... LDC | | LyleD Thursday, March 19, 2009 7:14 PM | Hi Robin,
I'd like to see the code for the desktop shortcut, we're using .net 2.0 as well.
Thx,
Luke | | MrBlue13 Thursday, March 19, 2009 8:54 PM | Here you go. This gets info from the assembly, which in our case matches the product name and company name. There's probablya simpler way to do this, but this works for me. It basically copies the shortcut from the start menu to the desktop.
/// <summary> /// This will create a Application Reference file on the users desktop /// if they do not already have one when the program is loaded. /// Check for them running the deployed version before doing this, /// so it doesn't kick it when you're running it from Visual Studio. /// </summary static void CheckForShortcut() { if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; if (ad.IsFirstRun) //first time user has run the app { Assembly code = Assembly.GetExecutingAssembly(); string company = string.Empty; string description = string.Empty; if (Attribute.IsDefined(code, typeof(AssemblyCompanyAttribute))) { AssemblyCompanyAttribute ascompany = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyCompanyAttribute)); company = ascompany.Company; } if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute))) { AssemblyDescriptionAttribute asdescription = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyDescriptionAttribute)); description = asdescription.Description; } if (company != string.Empty && description != string.Empty) { string desktopPath = string.Empty; desktopPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "\\", description, ".appref-ms"); string shortcutName = string.Empty; shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", company, "\\", description, ".appref-ms"); System.IO.File.Copy(shortcutName, desktopPath,true); } } } }
Ts'i mahnu uterna ot twan ot geifur hingts uto.- Proposed As Answer byMrBlue13 Tuesday, March 24, 2009 11:36 PM
- Marked As Answer byLyleD Wednesday, March 25, 2009 11:37 AM
-
| | RobinDotNet Tuesday, March 24, 2009 6:52 PM | Thanks Robin! I used the AssemblyProductAttribute instead of the description,
Cheers,
Luke | | MrBlue13 Tuesday, March 24, 2009 11:34 PM | Hi, Has anyone ever had issues with this code in windows xp (sp2 home edition) when installing a clickonce application with a limited user? I get a newly created file with extension .appref-ms that appears on the desktop. There may not be a problem with this code because it appears the shortcut in the start-up menu is also incorrectly created. It lists [application-name].appref-ms with no icon and the shortcut cannot be clicked to launch the application. Works fine when installing the application with an Administrator account. Any help appreciated. Thanks, Luke
| | MrBlue13 Monday, June 22, 2009 11:31 PM | It's not this code. This code just copies the shortcut from the start menu and puts it on the desktop. Try uninstalling the application, then clear out the ClickOnce cache and reinstall it. You are having some kind of installation problem, and it doesn't recognize the files as belonging to that user. RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Tuesday, June 23, 2009 12:28 AM | Thanks Robin, I will go a head and try your suggestion and get back to you. Luke
| | MrBlue13 Tuesday, June 23, 2009 12:49 AM | Hi Robin, I clear out the cache and still doesn't work. The start menu program shortcut is still created as [appname].appref-ms on windows xp when installing with a limited account. Works fine on all versions of Vista. Haven't tried windows 2000 yet. Any other suggestions? Thx, Luke
| | MrBlue13 Thursday, June 25, 2009 8:55 PM | Just tried an install on a windows xp pro edition computer and it worked fine. There must be something wrong with file associations on the other windows xp computer.
| | MrBlue13 Friday, June 26, 2009 12:05 AM | On the broken xp computer, this .bat file works with contents: "rundll32.exe dfshim.dll, ShOpenVerbShortcut C:\Documents and Settings\[username]\Start Menu\Programs\[company name]\[product name].appref-ms" | | MrBlue13 Friday, June 26, 2009 12:45 AM | Well, that's a good thing. On this problematic computer, the shortcut is fine on the start menu, but the code I provided copies the shortcut and then it's funky? That's definitely odd. But what you've done above works?
RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Friday, June 26, 2009 3:40 PM | Hi Robin, Sorry, your code does work, the shortcut is broken in the start menu to begin with. I should perhaps pose this question in a new thread. The scenario is so far: 1. Shortcut created fine in Vista under both limited/admin accounts. 2. Shortcut created fine in XP Professional under both limited/admin accounts. 3. Shortcut in start menu and desktop incorrectly created (shows as .appref-ms) in XP Home Edition only when installed under a limited account, under an administrator account, the shortcuts are created correctly on this problematic computer. For #3, I thought perhaps some sort of file association problem, however, it works under the admin account so I am at a loss of troubleshooting. Thanks for the reply, Cheers, Luke
| | MrBlue13 Friday, June 26, 2009 5:53 PM | The automatic removal of the desktop icon when uninstalling a Click-Once application, is caused by the 3.5 framework SP1 update. This happens regardless of the version of the framework (2.0) used to deploy the application. Just thought the question should actually be answered... | | MartyMpls Tuesday, September 15, 2009 2:43 PM | I agree that this is the cause. More people are seeing it because Microsoft started deploying the .NET 3.5 Framework SP-1 as a critical update in Windows Update. RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Tuesday, September 15, 2009 10:05 PM |
|