Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clickonce deployment to multiple environments

I have a WPF application that I want to deploy to our users via ClickOnce. We have four environments, System Testing, User Testing, Parallel production and Production. Each needs a different config file with server names and other things specific to the environment so they cannot all use the same code base. Most of the code is the same but the final package will be slightly different because of the different .config files.

What I'm finding is that we install a version in user testing, say version 05, then they test, and then when it comes time to give them the next version, we should just be able to put an updated package on the user test web server, then they can update their version by clicking on the deployment URL. But when they do this it says "application with the same identity already exists" and we have to uninstall through control panel in order to get version 06 to install. This seems wrong and not the point of clickonce.

How would you suggest I build and deploy this application to the four different environments so that in each environment we have the capability of just putting a new version on the server and the users testing or using it from that environment will just pull down the update and not need to uninstall anything?

like image 412
NZJames Avatar asked Feb 08 '13 14:02

NZJames


People also ask

What is the difference between ClickOnce deployment and Windows Installer deployment?

Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application.

Where do ClickOnce applications install to?

The clickonce application is deployed to a company LAN network folder. The clickonce application is set to be available online or offline.

How do I add files to ClickOnce deployment?

To add a file to a groupClick the Publish tab. Click the Application Files button to open the Application Files dialog box. In the Application Files dialog box, select the Group field for a file that you wish to include in the new group. In the Download Group field, select a group from the drop-down list.

Where are ClickOnce settings stored?

config file is stored in the user's Documents and Settings folder. In a ClickOnce application, <app>.exe. config lives in the application directory inside of the ClickOnce application cache, and user. config lives in the ClickOnce data directory for that application.


1 Answers

Having been looking for a solution myself for some time, it struck me that the final one I came up with is actually as simple as this:

  • Slow Cheetah for transforming the config files based on the selected build configuration (e.g. Debug/Release)
  • A property group per Build Configuration with the specific click-once project properties (e.g. ProductName and AssemblyName (for parallel installation of test and prod version), InstallUrl) in the project file.
  • Specifying additional properties (like ApplicationVersion, MinimumRequiredVersion) via msbuild when executing the /target:publish

There is no need to copy any config files manually as slow cheetah will handle this. The click once package will be created in the respective build configuration's output folder (e.g. bin/Debug or whatever you have).

The biggest advantage is that the build is the same for using Visual Studio or automatic builds using msbuild (except for the few additional properties which are completely optional). All you have to do to add additional environments to your build is to create new build configurations and the respective slow cheetah transformations and a property group in the project file.

The whole setup is working at least with .NET 3.5 (can't speak about earlier versions) and later.

Maybe this helps anyone. Feel free to ask for details.

PS: The property groups look like this (put them after the first property group that defines the default ClickOnce settings):

  <PropertyGroup Condition=" '$(Configuration)' == 'Demo' ">
    <AssemblyName>Com.MyApplication.Main.Demo</AssemblyName>
    <InstallUrl>http://demoserver/myapp/</InstallUrl>
    <ProductName>My Application %28Demo%29</ProductName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Test' ">
    <AssemblyName>Com.MyApplication.Main.Test</AssemblyName>
    <InstallUrl>http://testserver/myapp/</InstallUrl>
    <ProductName>My Application %28Test%29</ProductName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Prod' ">
    <AssemblyName>Com.MyApplication.Main</AssemblyName>
    <InstallUrl>http://prodserver/myapp/</InstallUrl>
    <ProductName>My Application</ProductName>
  </PropertyGroup>
like image 58
Martin Klinke Avatar answered Sep 27 '22 20:09

Martin Klinke