如何防止MSDeploy删除项目中的其他文件夹?

如何防止MSDeploy删除项目中的其他文件夹?

问题描述:

我正在Team City中使用MSBuild运行程序来构建我的项目并将其部署到暂存环境.一切正常,除了不断删除位于项目根目录中的我的存储库文件夹.

I am using the MSBuild runner in Team city to build and deploy my project to a staging environment. Everything works perfectly except for the fact that it keeps removing my repository folder located in the root of the project.

在Visual Studio 2010中,发布配置文件"对话框中有一个复选框,显示在目标上保留额外的文件(请勿删除)"

In Visual Studio 2010 there is a check box in the publish profile dialog that says "Leave extra files on destination (do not delete)"

有没有办法用MSBuild完成相同的事情?

Is there a way to accomplish the same thing with MSBuild?

<Target Name="Deploy" DependsOnTargets="Build;Test">
        <MSBuild Projects="MyProject.sln" Properties="Configuration=$(Configuration); username=username; password=password; DeployOnBuild=True; DeployTarget=MSDeployPublish; MSDeployPublishMethod=WMSVC; MSDeployServiceUrl=https://DEVWEB01:8172/MsDeploy.axd; DeployIISAppPath=MyProject.$(Configuration); AllowUntrustedCertificate=True;"/>
</Target>

找到了答案!

您需要做的就是将以下属性添加到属性"属性中:

All you need to do is add the following property to the Properties attribute:

SkipExtraFilesOnServer = True;

SkipExtraFilesOnServer=True;