从Visual Studio 2015出版物中排除文件夹
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Visual Studio 2015出版物中排除文件夹相关的知识,希望对你有一定的参考价值。
我需要从项目的发布中排除文件夹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.-将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中测试过。
以上是关于从Visual Studio 2015出版物中排除文件夹的主要内容,如果未能解决你的问题,请参考以下文章
在 Visual Studio 2015(Web 项目)中排除/忽略文件夹
.cpp 文件中的 Visual Studio 2015 IntelliSense #included 作为标头
Visual Studio 2015 TFS .tfignore 文件