来自两个不同的位置安装一个点击一次应用程序应用程序、不同、位置、两个

2023-09-07 02:40:17 作者:这城市那么空这回忆那么凶

我公司开发的WinForm应用程序在.NET中使用C#框架3.5 Service Pack 1中的应用程序可以根据开发数据库和生产数据库中予以公布。我使用MS建立社区任务来发布我的应用程序。同时发布的应用程序,以不同的位置,即一个开发地点和生产地点我没有遇到任何问题。

I have a winform 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 ms build 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"

2)的疑问:如何机器明白,我试图安装相同的应用程序?我认为它具有某种应用程序ID的。如果多数民众赞成的情况下,我可以覆盖基于位置的关注价值。 (DEV或PROD)

2) Doubt: 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 thats the case, I can override the concerned value based on the location. (DEV or PROD)

目前的code,同时发布在我的应用程序的项目文件

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)的疑问:什么区别只需轻轻点击一次应用程序与其他

3) Doubt: What differentiates one click once application with the other?

任何想法AP preciated。 更新

Any ideas appreciated. UPDATE

我已经回答了下面我自己的问题。

I have answered my own question below.

推荐答案

所以,我终于想通了如何部署不同版本的同一应用程序。应用程序清单文件中缺少部署元素 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.

在添加应用程序清单部署元素的部署提供属性之后,我能够从不同的位置安装我的应用程序。但这里的问题是,它覆盖了previously安装的应用程序。对于这个问题,我也跟着本教程区分我从生产应用程序的开发应用。

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