Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 18-Sep-12 9:58am
v2
Comments
TRK3 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 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 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 <application> is not the default for opening <filetype>. 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 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 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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900