Installing a ClickOnce application from two different locations
Asked Answered
S

4

5

I have a Windows Forms application developed using C# in .NET framework 3.5, Service pack 1. The application can be published based on the development database as well as the production database. I am using MSBuild community tasks to publish my application. I do not face any problems while publishing the application to different location, namely a development location and a production location.

Issue:

  1. After installing the development application into my machine, I am unable to install the production application. It gives me an error saying:

    You cannot start application TEST from this location because it is already installed from a different location

  2. Question: How does the machine understand that I am trying to install the same application? I assume it has some kind of an Application Id. If that's the case, I can override the concerned value based on the location. (DEV or PROD)

    The current code while publishing in the project file of my application:

    <Choose>
        <When Condition=" '$(BuildEnvironment)' == 'DEV' ">
          <PropertyGroup>
            <PublishDir>\\A\B\development\</PublishDir>
            <BaseConnection>Data Source=SQL-DEV.company.com; Database=TEST;Uid=XYZ;Pwd=ABC;</BaseConnection>
    
          </PropertyGroup>
        </When>
    
        <When Condition=" '$(BuildEnvironment)' == 'PROD' ">
          <PropertyGroup>
            <PublishDir>\\A\B\production\</PublishDir>
            <BaseConnection>Data Source=SQL-PROD.company.com;; Database=TEST;Uid=XYZ;Pwd=ABC;</BaseConnection>
    
          </PropertyGroup>
        </When>
    </Choose>
    

    The publishing of the application works like a charm and points to the concerned database. All I want to do now is be able to install the development application as well as production application on the same machine without any errors.

  3. Question: What differentiates one click once application with the other?

Syd answered 15/3, 2011 at 19:25 Comment(0)
S
6

So I have finally figured out how to deploy different versions of the same application. The application manifest file was missing deploymentProvider attribute of the deployment element.

After adding deployment provider attribute of the deployment element in the application manifest, I was able to install my app from various location. But the problem here was that it was overriding the previously installed application. For this problem, I followed this tutorial to distinguish my development application from the production application.

Everything works great now. :)

Syd answered 16/3, 2011 at 16:48 Comment(1)
Looks like signing with Mage.exe is required after editing the menifest.Jerrome
C
1

I have a product called ClickOnceMore (www.clickoncemore.net) that is designed for this type of use. Its main use is in automating the ClickOnce part of your build.

It has full support for macro expansions allowing you to define, for example, DEV and PROD versions. When you build you can define which environment you are building for and then the App Name will reflect that. Check it out if you get a chance.

Chimborazo answered 25/3, 2011 at 9:32 Comment(0)
S
0

The first thing I'd try is to go to the project properties of your Windows Forms project. In the Publish tab click on the Options button and change the "Product Name" to YourProductName_Test or something similar and see if that will allow you to install two versions side by side.

I never tried this, but I think ClickOnce apps are uniquely identified by a combination of "Publisher Name" and "Product Name" values and if that is the case this might solve your problem... Give it a shot...

Sabu answered 15/3, 2011 at 19:34 Comment(3)
That was one of the first things I tried to distinguish my dev and prod application while publishing them. But, that doesn't work.Syd
So the bottom line is that the assembly name and the product name must be changed...Sabu
Yeah. I had to change the assembly name as well as the product name to differentiate the versions. The major problem I had was that the setup didnot allow me to install the second version at all. introducing the deployment provider helped me to install it.Syd
C
0

I know this is an old thread, but I had this same error with WPF while trying to update and older version of the program. I had to uninstall the older version and rerun the click once installer then it worked fine.

I thought i would post it here.

Coacher answered 3/1, 2017 at 0:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.