如何强制部署项目在安装新版本期间更新文件?

Sim*_*her 5 c# deployment windows-installer visual-studio-2008

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.

我希望我的安装程序自动删除已安装应用程序的所有旧版本。为此,我遵循以下程序(也在此描述):

  1. 将RemovePreviousVersions 设置为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.*")]
Run Code Online (Sandbox Code Playgroud)

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.

Lin*_*nda 5

将以下属性添加到 MSI 的属性表中:属性 REINSTALLMODE 和值 amus

注意:这将导致 MSI 中的所有文件(版本化和非版本化)覆盖系统上的文件。


CJB*_*rew 2

如果您愿意使用 Orca(可能还有另一种方法可以执行此方法,但这是我所知道的唯一一种),您也许可以设置 RemoveFile 指令。

请参阅此处典型的轻量级 MSDN 文档——可能是一个起点。 http://msdn.microsoft.com/en-us/library/aa371201.aspx

或者,您始终可以创建一个非常简单的引导程序可执行文件,只需调用“msiexec /i REINSTALLMODE=oums”(或任何需要的命令行开关)。如果你愿意的话,可以将其命名为 setup.exe...

从长远来看,更好的选择可能是切换到 InstallShield 或类似的版本 - VS2010 包含 IS 的轻型版本,我相信他们正在放弃 vdproj 项目。