views:

161

answers:

3

I have a WinForms app that I recently re-wrote in WPF and I need to release to my end users. I'd like to be able to have the users go to the ClickOnce install point for the WPF application and have their WinForm application removed so they don't have both on their machine

What's the best way (read: easiest for users) of accomplishing this?

I have thought about creating an prereq command line app to detect the old version and uninstall, but would like to avoid having to write an something like that where it only get's run once.

+1  A: 

I haven't tried it, but could you make your WPF app directly replace your WinForms app? If you publish to the same folder, copy the right GUID's from the old project to the new project, it might just install seamlessly.

That won't remove the old versions, but every update to a ClickOnce app leaves the old versions in place.

Alternatively, can you transform your existing WinForms project into a WPF project? Is it just a different set of assembly references? I've never written a WPF app, so forgive me if this is obviously wrong.

Don Kirkby
A: 

Why not simply give the new WPF application the same <ProjectGuid>, <PublishUrl>, etc and a higher major version number?

ClickOnce won't even be aware you switched from WinForms to WPF technology.

Normal ClickOnce version update functionality will automatically replace the old code with the new the next time the application is updated (which can be set to happen automatically if desired).

Ray Burns
I tried this and the WinForm app didn't present an update dialog. When I launched the WPF app, it installed alongside the WinForm app. Do you know which pieces one would need to copy from project to project to ensure it has the same identity?
Tyler
My memory was hazy so I tried some experiments to confirm. It appears that if the new project has the same assembly name and is signed with the same public key, it will have the same ClickOnce identity. Are you sure you are using the same certificate to sign both projects and both projects have exactly the same name? If this has been verified, I would try copying over the settings in AssemblyInfo.cs starting with `<Assembly: Assembly`. If it still doesn't work I might try copying the `<ProjectGuid>` and `<PublishUrl>` in the .csproj. Hopefully one of these will do the trick.
Ray Burns
+1  A: 

I think you actually SHOULD be able to deploy the WPF version as a new version of the Windows Forms application.

What version of the .NET Framework do each of the applications target?

Is the assembly name on both projects the same, and is the installation URL the same? (For ClickOnce, it has nothing to do with the projectGUID.)

RobinDotNet