从两个不同的位置安装ClickOnce应用程序 [英] Installing a ClickOnce application from two different locations

查看:407
本文介绍了从两个不同的位置安装ClickOnce应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用C#.NET Framework 3.5开发的Windows Forms应用程序,Service Pack 1.应用程序可以根据开发数据库以及生产数据库进行发布。我正在使用MSBuild社区任务来发布我的应用程序。将应用程序发布到不同的位置(即开发地点和生产地点)时,我不会面临任何问题。

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.

问题:


  1. 将开发应用程序安装到我的机器后,无法安装生产应用程序。它给我一个错误说:

  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


  • 问题:机器如何理解我正在尝试安装相同的应用程序?我认为它有某种应用程序标识。如果是这样,我可以根据位置覆盖相关的值。 (DEV或PROD)

  • 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.

    问题:什么区别点击一次应用程序与另一个?

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


    推荐答案

    所以我终于弄清楚了如何部署不同版本的同一个应用程序。应用程序清单文件缺少部署元素的 deploymentProvider属性。

    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.

    一切都很好, :)

    这篇关于从两个不同的位置安装ClickOnce应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆