排除Visual Studio 2015出版物中的文件夹 [英] excluding folders from Visual Studio 2015 publication

查看:97
本文介绍了排除Visual Studio 2015出版物中的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从项目发布中排除文件夹media,umbraco和umbraco_client.这些文件夹很少更改,我不想每次都等待,直到它们在FTP服务器上的发布过程中被复制为止.这是我的配置local.pubxml:

I need to exclude folders media, umbraco and umbraco_client from the publication of the project. These folders are rarely changed and I do not want to wait each time until they are copied during the publication on the FTP server. Here is my config 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文件夹,但它也不能解决问题.有任何想法吗? :)

After that media folder is not published, but umbraco and umbraco_client folders still continue to copy in the process of publication. After that, I excluded umbraco and umbraco_client folders from the project, but it also does not solve the problem. Any ideas? :)

推荐答案

在出现一些问题后,我使这项工作可行,也许对您的情况有所帮助:

I make this work after some problems, perhaps it helps your case:

1.-将MsDeploySkipRules移到与.csproj相同的文件夹中的名为yourprojectname.wpp.targets的单独文件中,并包含以下内容(您必须为每个文件夹添加通配符的filePath和dirPath):

1.- Move your MsDeploySkipRules in a separate file named yourprojectname.wpp.targets in the same folder as .csproj, with the following content (you must put a filePath and dirPath for each folder with its wildcards):

<?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的情况下再次进行部署,然后他们不欣赏任何更改,并且错误地认为它不起作用).

2.- After that (VERY IMPORTANT) save the file, close your Visual Studio and open it again. Many people fail at this point (they modify the file and try to deploy again without closing VS, and then they do not appreciate any change and they wrongly believe it does not work).

3.-尝试再次发布.

3.- Try to publish again.

在Visual Studio 2015中测试.

Tested in Visual Studio 2015.

这篇关于排除Visual Studio 2015出版物中的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆