在
Windows 2012 Server上使用Web Deploy,如果部署的文件夹中包含用户生成的内容,我将其从.pubxml文件中的发布中排除:
<ExcludeFoldersFromDeployment>somefoldername</ExcludeFoldersFromDeployment>
如果使用“在目标位置删除其他文件”选项进行部署,则仍会从实时服务器中删除此文件夹中的文件.
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
有没有办法使部署过程,包括清理实时服务器,忽略指定的文件夹?我喜欢知道发布过程也从服务器中删除已删除或修改过的文件,但是擦掉用户生成的数据的整个文件夹显然是个问题!
以下是我的CustomProfile.pubxml文件,我用它来保留LetsEncrypt的.well-已知文件夹,以及其他文件夹.以粗体添加以下项目以排除服务器上的处理文件,例如用户生成的内容.
这仅在使用Server 2016的Visual Studio 2017上进行了测试.
这仅在使用Server 2016的Visual Studio 2017上进行了测试.
<?xml version="1.0" encoding="utf-8"?> <!-- This file is used by the publish/package process of your Web project. You can customize the behavior of this process by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. --> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developermsbuild/2003"> <PropertyGroup> <WebPublishMethod>MSDeploy</WebPublishMethod> </PropertyGroup> <PropertyGroup> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedPlatform>Any cpu</LastUsedPlatform> <SiteUrlToLaunchAfterPublish>https://www.vinceworks.com</SiteUrlToLaunchAfterPublish> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <ExcludeApp_Data>True</ExcludeApp_Data> <MSDeployServiceURL>https://www.vinceworks.com</MSDeployServiceURL> <DeployIisAppPath>VinceWorks</DeployIisAppPath> <RemoteSitePhysicalPath /> <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer> <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> <EnableMSDeployBackup>True</EnableMSDeployBackup> <UserName>Vince</UserName> <_SavePWD>True</_SavePWD> <PrecompileBeforePublish>True</PrecompileBeforePublish> <EnableUpdateable>True</EnableUpdateable> <DebugSymbols>False</DebugSymbols> <WDPMergeOption>DonotMerge</WDPMergeOption> </PropertyGroup> <ItemGroup> <MsDeploySkipRules Include="CustomSkipFolder"> <ObjectName>dirPath</ObjectName> <AbsolutePath>VinceWorks\\\.well-known</AbsolutePath><!--Regular Expression here--> </MsDeploySkipRules> </ItemGroup> <ItemGroup> <MsDeploySkipRules Include="CustomSkipFolder"> <ObjectName>dirPath</ObjectName> <AbsolutePath>VinceWorks\\Media</AbsolutePath> </MsDeploySkipRules> </ItemGroup> <ItemGroup> <MsDeploySkipRules Include="CustomSkipFolder"> <ObjectName>dirPath</ObjectName> <AbsolutePath>\\Views</AbsolutePath> </MsDeploySkipRules> </ItemGroup> </Project>