Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET VS2010 ClickOnce , +
I have a Windows Forms App that was built with VS 2005 and uses ClickOnce to deploy. I am trying to update it to VS 2010. I wanted to upgrade to VS 2010 to take advantage of the fancier ClickOnce ability to setup proper File Associations. I made a test project in VS 2010 and found that the file associations worked like a charm. However, with my App, I am running into an issue. My old app contained code that manually added some registrty settings to get the file associations to work (at least on XP...couldn't get it to work properly on Vista and Windows 7 because of security/permission issues, which is why having the ClickOnce handle it is going to be so nice...). So now I have my upgrade app but the file association isn't working. I assume it is because that file association extension already exists for my old app. I assume this because when I click on those documents, the OLD program launches and opens the file. If I try publishing my upgraded app requesting a different extension for my file association it works fine. The problem is that I don't really want to use a different file extension because my users have many documents already saved with the old extension. Does anyone know a way to handle this situation gracefully?
Posted 18-Sep-12 8:47am
Kschuler32.5K
Edited 18-Sep-12 9:58am
v2
Comments
TRK3 at 18-Sep-12 19:04pm
   
Couple of thoughts:
 
1. Can you configure your deployment so that it uninstalls the old app? (Might have to manually ensure some GUIDs match somewhere...)
 
2. Can you take the registry twiddling code from you old app and include a modified version in the new app so that (if you are running on XP) it fixes up the registry to point to your new app?
 
3. Can you stop supporting XP? (I know I can't. We official dropped support for XP 6 months ago, but I still have too many customer using XP to actually ignore it.)
Kschuler at 19-Sep-12 9:35am
   
Thanks for taking the time to think about my issue.
1. I found an article about doing this, but wasn't too concerned with it. I'm okay with having my users keep the old version for a while if they need it. Plus, uninstalling it won't take away the registry settings. I did that in code when the app loads, because the first version of that app didn't have that feature. So, I don't see uninstalling it as a solution.
2. I sort of tried to take the old code and "unregister" it in the new app, but it didn't seem to work. I think it's a timing thing. I don't know when the ClickOnce tries to perform it's file association (I suspect it happens just once when the app is installing and BEFORE the app actually runs, which means it would fail to get it's file association completed before my code could run to fix it) and I don't know what exactly it changes in the registry, so I don't want to go deleting stuff from the registry that might actually be needed by the ClickOnce file association.
3. I can't stop supporting XP. We still have many computers using it.
 
If you have any other ideas, please let me know.
TRK3 at 19-Sep-12 14:26pm
   
1. If you expect your users to keep both versions installed, then it's reasonable to require them to manually decide which is going to be the default.
 
What happens if you uninstal an app that is the default app for opening some file type. Does XP then open it with another app that is registerdd for that file type, or does it ask you to manually decide what app to use? Either way, is that an acceptable behavior?
 
2. There are a lot of apps (browsers, music players, iTunes, video players) that tell you "We detected that is not the default for opening . Would you like to change it?" -- you might look into how they do that and implement something like that in your new version.
 
3. Pity.
 
Good luck.
Kschuler at 19-Sep-12 14:37pm
   
I know what you mean about asking the user which app to use...but the whole point of the ClickOnce part of it is that it's a simple setting that I put in ClickOnce just handles making it work. If I go with the idea that they can select the app they want, then I have to handle it manually, which I was already doing (but badly) and don't really want to do. Plus, the file extension I'm using isn't a common file you'd use in any other app. We made it up specifically for our app to save selections the user has made. My ideal solution for this specific scenario would be that if they installed the new app, any time they click on a document with my extension it would open in the new app even if they had the old one installed. They could still use the old program, but they'd have to launch it and use the open dialog to find the file they want to open in it. But I'm thinking this isn't going to be possible because of how I manually did the registry settings for the file extension.
TRK3 at 19-Sep-12 16:18pm
   
Can't you just:
 
IF OS == XP && registry contains whatever hack I did for the old app THEN
alter the hack to point to the new app
END
 
On Vista and Win 7 you get all the ClickOnce goodness and on XP you get the behavior you want at the cost of duplicating your previous hack.
Kschuler at 19-Sep-12 16:24pm
   
No, because my old hack never really worked anyway. It would setup a file association to the currently running version of the App, but then there would be issues when the program had to update to a new version. The old version of the app would still be associated to the file extension until the new app was run...and even then we had some funky problems with it.
 
I'm pretty sure I'm just going to end up using a new file extension and including a feature in the new app that will convert old files to the new extension for the user. Then I can just use the new ClickOnce feature for all OS and forget about it.
TRK3 at 19-Sep-12 18:13pm
   
I get it. Oh well.
Kschuler at 20-Sep-12 9:29am
   
Thanks for your input.
BillWoodruff at 24-Sep-12 8:55am
   
Wish I could up-vote Kschuler for his patient comments !
 
I'd raise this question on MS's support forum for ClickOnce:
 
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/threads
Kschuler at 24-Sep-12 10:01am
   
Good idea. I've posted my question there as well. If they give me any ideas I will be sure to update the answer here too. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 210
1 Richard MacCutchan 100
2 kbrandwijk 90
3 ProgramFOX 80
4 Mukesh Bhagat 65
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100