我需要从项目的发布中排除文件夹media,umbraco和umbraco_client。这些文件夹很少更改,我不想每次等待,直到它们在FTP服务器上发布时被复制。这是我的配置local.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>My_path</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeFoldersFromDeployment>media;umbraco;umbraco_client</ExcludeFoldersFromDeployment>
<MSDeployUseChecksum>true</MSDeployUseChecksum>
<AfterAddIisSettingAndFileContentsToSourceManifest>AddCustomSkipRules</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
<MsDeploySkipRules Include="SkipmediaFolder">
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\media</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbracoFolder">
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbraco_clientConfig">
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco_client</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
</Project>
在未发布该媒体文件夹之后,umbraco和umbraco_client文件夹仍会在发布过程中继续复制。之后,我从项目中排除了umbraco和umbraco_client文件夹,但它也没有解决问题。有任何想法吗? :)
答案 0 :(得分:2)
我在遇到一些问题之后做了这个工作,也许这有助于你的情况:
1.-将MsDeploySkipRules移动到名为yourprojectname.wpp.targets的单独文件中,与.csproj位于同一文件夹中,其中包含以下内容(必须为每个文件夹及其通配符放置一个filePath和dirPath):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<MsDeploySkipRules Include="SkipmediaFolderFiles">
<SkipAction></SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\media\\.*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipmediaFolderChildFolders">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\media\\.*\\*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbracoFolderFiles">
<SkipAction></SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco\\.*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbracoFolderChildFolders">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco\\.*\\*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbraco_clientFolderFiles">
<SkipAction></SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco_client\\.*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipUmbraco_clientFolderChildFolders">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\umbraco_client\\.*\\*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Project>
2.-之后(非常重要)保存文件,关闭Visual Studio并再次打开它。许多人在这一点上失败了(他们修改文件并尝试再次部署而不关闭VS,然后他们不理解任何改变,他们错误地认为它不起作用)。
3.-尝试再次发布。
在Visual Studio 2015中测试。