我需要从项目的发布中排除文件夹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文件夹,但它也没有解决问题。什么好主意吗?:)
我做了一些问题后,也许它有助于您的情况:
1。-将msdeployskiprrules移动到一个名为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。-尝试再次发布