28

We have several deployments of the same assemblies with different configuration files for different environments. We package these up in to separate ClickOnce deployments with different Deployment Identities (Program_ENV1, Program_ENV2, etc.).

The Application Identity is Program.exe for all of them, because we have a third-party component that requires the executable using it to have the same name as it was compiled for.

When we want to have multiple installs of the same version number on the same machine (for testing), we get an error on installation that something with the same application identity already exists.

We don't want to make separate builds with new version numbers for each deployment (QA signed off on version X.X.X.45 assemblies, not version X.X.X.46).

Is there another way around this issue?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Karg
  • 1,467
  • 3
  • 15
  • 18

5 Answers5

21

To run concurrent versions of a ClickOnce application, you must change the AssemblyName, and it's recommended that you also change the ProductName in the Publish properties, so you can tell in a start menu which one is which.

blackgreen
  • 34,072
  • 23
  • 111
  • 129
RobinDotNet
  • 11,723
  • 3
  • 30
  • 33
4

I ended up using -u -Update option to create a new Deployment for QA based on Production.

Here are the steps I did to test a verify

  1. create a simple WPF application
  2. copied mage.exe to the project since Visual Studio can't resolve it at build time
  3. Added the below text to the project's post build

cd "$(TargetDir)"

"$(ProjectDir)mage.exe" -New Application -Name $(ProjectName) -p msil -TrustLevel FullTrust -Version 1.0.0.0 -FromDirectory . -ToFile ".\$(TargetFileName).manifest"

"$(ProjectDir)mage.exe" -New Deployment -Install false -Name $(ProjectName) -p msil -Version 1.0.0.0 -AppManifest ".\$(TargetFileName).manifest" -ToFile ".\$(TargetName).application"

"$(ProjectDir)mage.exe" -Update ".\$(TargetName).application" -Install false -Name $(ProjectName).QA -p msil -Version 1.0.0.0 -AppManifest ".\$(TargetFileName).manifest" -ToFile ".\$(TargetName).QA.application"

I needed to change to the "$(TargetDir)" via cd "$(TargetDir)" because mage wouln't process directories and filepaths correctly when I gave it paths with spaces that are enclosed in double quotes. To get around that, I set the current directory to the location of where the files are built to.

The 2nd line creates the manifest file

The 3rd line creates the Production deployment file.

The 4th line creates the QA deployment file from the Production deployment file. (NOTE: I'm adding QA to the deployment file and the Application Name.)

The 4th line causes a 2nd application file to get created. When both applications are ran, they will have the same binaries but the ApplicationDeployment.UpdateLocation will be different for each. One will have the filename $(TargetName).application and the other will have the filename $(TargetName).QA.application. In my code I can use this to determine which 'Version' of the Application was ran (QA or Production)

Hasani Blackwell
  • 2,026
  • 1
  • 13
  • 10
  • I found the issue with mage and directory paths... It doens't like trailing slashes. This can be fixed by adding a period at the end E.x.: It will work with "C:\Foo\Bar\." but not "C:\Foo\Bar\" – Hasani Blackwell May 04 '12 at 06:42
  • 1
    Any ideas how to get this working with a signed ClickOnce app? I'm trying to get it done, but it doesn't seem so easy... – Per Lundberg May 23 '14 at 07:36
1

Try using MageUI. Open your deployment manifest (the one with the .application extension). Select "Name" from the list on the left and edit the "Name" textbox. Then select "Description" from the list and edit the "Product" field. That way you'll be able to distinguish your different installs on the start menu and in add/remove programs.

Save your changes, re-sign the manifest, and you should be good to go.

codeConcussion
  • 12,739
  • 8
  • 49
  • 62
  • 1
    The display names are already different for the different environment deploys. This issue is that they have the same Application Identity and ClickOnce isn't letting them be installed side by side on the same machine. – Karg Aug 04 '09 at 16:21
  • Did you actually try my solution? Setting the "Name" property through MageUI changes your Application Identity and allows multiple versions of your app to be installed side-by-side. If your display name is already different, then you don't need to bother changing the "Description" property. – codeConcussion Aug 04 '09 at 19:12
  • @codeConcussion, I followed your steps. But still updated name does not show up in start and add/remove programs. Any thoughts? Thanks. – Sh Ale Aug 18 '14 at 08:01
1

Karg, if you use MageUI you can change the ApplicationIdentity and run several published versions of the same application at once.

TabbyCool
  • 2,829
  • 1
  • 24
  • 36
-1

For each environment, keep separate assembly names and product names with a postfix of the environment name. In addition, create a GUID for each environment, and add it to the AssemblyInfo.cs, for example:

[assembly: GuidAttribute("FA380FBE-11B0-406E-88D3-AF40BE93F7D6")]

This then makes it possible to run the same application from separate ClickOnce sites, each having a short cut corresponding to the product name.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nigel Findlater
  • 1,684
  • 14
  • 34
  • Useful answer, but it doesn't answer the original question: "The Application Identity is Program.exe for all of them because we have a third-party component that requires the executable using it to have the same name as it was compiled for.". Downvoting therefore. – Per Lundberg May 22 '14 at 18:38