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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I found solution my self.!
you have to edit WebDeploy project Right click and OpenProject File. and its Extension must be .wdproj.
Add these Property Group
<PropertyGroup>
<TransformWebConfigEnabled>False</TransformWebConfigEnabled> <AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
And for more help you can follow link.
[1]: Can't rename MSI afterwards
and for Help:
[2]: https://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/