本文介绍了通过msi Installer将文件复制到目标目录之前,请备份目标目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用常规的Visual Studio安装项目来部署我的ASP.NET应用程序.我需要处理目标目录中存在的现有web.config的情况.找到一个后,需要在安装之前将其重命名.如果这没有发生,则新的web.config将不会覆盖旧的.复制正在安装的文件之前,如何获得自定义操作来重命名旧的web.config?到目前为止,我已经尝试过从System.Configuration.Install.Installer派生并覆盖OnBeforeInstall,Install和Commit.所有这些方法似乎都是在将新文​​件复制到目标目录之后发生的.

I am using a regular Visual Studio Setup Project to deploy my ASP.NET application. I need to handle the case of an existing web.config existing in the target directory. When one is found, it needs to be renamed before the install takes place. If this does not happen, the new web.config will not overwrite the old.How can I get my custom action to rename the old web.config BEFORE the files being installed are copied?So far I have tried by deriving from System.Configuration.Install.Installer and overriding the OnBeforeInstall, Install and Commit. It seems that all of these methods take place after the new files are copied into the target directory.

推荐答案

我找到了解决方案.

您必须编辑WebDeploy项目右键单击并打开OpenProject文件.并且其扩展名必须是.wdproj.

you have to edit WebDeploy project Right click and OpenProject File. and its Extension must be .wdproj.

添加这些媒体资源组

<PropertyGroup>
<TransformWebConfigEnabled>False</TransformWebConfigEnabled>    <AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  </PropertyGroup>

要获得更多帮助,您可以点击链接.

And for more help you can follow link.

[1]:之后无法重命名MSI

[1]: Can't rename MSI afterwards

并寻求帮助:

[2]: https ://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/

[2]: https://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/

这篇关于通过msi Installer将文件复制到目标目录之前,请备份目标目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:18