Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a ClickOnce application from two different locations

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?

like image 554
reggie Avatar asked Mar 15 '11 19:03

reggie


People also ask

Where does a ClickOnce application get installed?

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

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.


2 Answers

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. :)

like image 170
reggie Avatar answered Sep 19 '22 00:09

reggie


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.

like image 23
Greg Avatar answered Sep 23 '22 00:09

Greg