在安装新版本时如何强制部署项目更新文件? [英] How to force deployment project to update files during installation of newer version?

查看:159
本文介绍了在安装新版本时如何强制部署项目更新文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VS2008 C#应用程序的部署项目。当安装新版本的应用程序时,我想确保文件更新为安装程序中包含的文件。



我希望我的安装程序自动删除任何旧版本的安装应用程序。为此,我遵循此过程(也描述了这里):


  1. 将RemovePreviousVersions设置为True

  2. 将DetectNewerInstalledVersion设置为
    True

  3. 增加
    安装程序的版本

  4. 选择是更改ProductCode



    1. 对于程序集,我确保AssemblyVersion设置为更高版本:

        [assembly:AssemblyVersion(1.0。*)] 

      我的配置文件(xml文件)。由于我找不到版本这些文件的方法,因为目标机器上已经修改了这些文件,我无法确定文件是否更新。



      有没有办法这样做和如何?



      更新:我尝试了方法/解决方案/解决方案找到 here


      1. 将文件直接包含在
        项目中,其中包含以下
        属性:构建操作 - >内容
        文件和复制到输出目录
        - >始终复制

      2. 然后通过Project
        将其添加到部署
        项目中输出 - >数据库 - >内容文件

      不幸的是没有任何区别。行为是完全一样的。

      解决方案

      如果你愿意使用Orca(可能还有另一种方法来做这个方法,但它是唯一一个我知道的)您可能可以设置RemoveFile指令。



      看到这里一个典型的轻量级MSDN文档 - 可能是一个初始点。
      http://msdn.microsoft.com/en-us/library /aa371201.aspx



      或者,您可以随时创建一个非常简单的引导程序可执行文件,只需调用msiexec / i REINSTALLMODE = oums(或任何命令行需要开关)。调用setup.exe如果你喜欢...



      更好的选项长期可能是切换到InstallShield或类似的 - VS2010包括轻型版本的IS和I相信他们正在离开vdproj项目。


      I have a Deployment Project for my VS2008 C# application. When installing a new version of my application I want to make sure that files are updated with the files contained in the installer.

      I want my installer to automatically remove any old version of the installed application. To do that I follow this procedure (also described here):

      1. Set RemovePreviousVersions to True
      2. Set DetectNewerInstalledVersion to True
      3. Increment the Version of the installer
      4. Choose Yes to change the ProductCode

      For the assemblies I make sure the AssemblyVersion is set to a higher version:

      [assembly: AssemblyVersion("1.0.*")]
      

      Everything is working as intended except for my configuration files (xml files). Since I cannot find a way to "version" these files I cannot make sure that the files are updated if they have been modified on the target machine.

      Is there any way to do this and how?

      UPDATE: I have tried the approach/solution/workaround found here

      1. Include the file directly in a project with the following properties: "Build Action -> Content file" and "Copy to Output Directory -> Copy always"
      2. Then add it to the deployment project via Project Output->Database->Content Files

      Unfortunately it did not make any difference. The behavior is exactly the same.

      解决方案

      If you're willing to use Orca (there may be another way to do this method, but it's the only one I know of) you may be able to set up RemoveFile directives.

      See here for a typically light-weight MSDN document -- could be a starting point. http://msdn.microsoft.com/en-us/library/aa371201.aspx

      Alternatively you could always create a very simple bootstrapper executable that simply calls "msiexec /i REINSTALLMODE=oums" (or whichever command-line switches are needed). Call it setup.exe if you like...

      Better option long-term may be to switch to InstallShield or similar -- VS2010 includes a light version of IS and I believe they're moving away from vdproj projects.

      这篇关于在安装新版本时如何强制部署项目更新文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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