2016-09-19 109 views
0

我需要從項目發佈中排除文件夾媒體,umbraco和umbraco_client。這些文件夾很少更改,我不想每次都等待,直到它們在FTP服務器上發佈期間被複制。下面是我的配置local.pubxml:從Visual Studio 2015出版物中排除文件夾

<?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

這種方法對我來說總是有效。當您最初完成時可能會出現問題。你不能刪除當前的配置文件,並重新開始?有時候VS很有氣質。 –

回答

1

我做這項工作的一些問題之後,也許它可以幫助你的情況:

1.-移動你的MsDeploySkipRules在一個單獨的文件名爲yourprojectname.wpp.targets在同一文件夾中的.csproj,與以下內容(你必須把文件路徑和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中測試過。

相關問題