visual studio 2015 .net 核心发布未使用 `ExcludeFoldersFromDeployment`

visual studio 2015 .net core publish not using `ExcludeFoldersFromDeployment`

在 VS 2015 中,在一个 Web 项目中,我将其作为我的 *.pubxml 文件

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<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>
    <PublishFramework>netcoreapp1.0</PublishFramework>
    <UsePowerShell>True</UsePowerShell>
    <publishUrl>Y:\timelapse_player</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
    <ExcludeFilesFromDeployment>**\media\**\*.*</ExcludeFilesFromDeployment>
    <ExcludeFilesFromDeployment>**\ftp_drop\**\*.*</ExcludeFilesFromDeployment>
    <ExcludeFoldersFromDeployment>media</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>ftp_drop</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>**\media</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>**\ftp_drop</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>..\media</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>..\ftp_drop</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>wwwroot\media</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>wwwroot\ftp_drop</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>wwwroot\media\</ExcludeFoldersFromDeployment>
    <ExcludeFoldersFromDeployment>wwwroot\ftp_drop\</ExcludeFoldersFromDeployment>
</PropertyGroup>
<ItemGroup>
    <media Include="media\**\*.*" />
    <ftp_drop Include="ftp_drop\**\*.*" />
</ItemGroup>
<PropertyGroup>
    <ExcludeFilesFromDeployment>@(media);@(ftp_drop)</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>

而且这些规则中没有一条被采纳。如果我观看 \AppData\Local\Temp\PublishTemp\PROJECT_NAME,我会看到文件夹连同文件一起复制到那里。我需要做的就是不将 media 文件夹发送到服务器,因为它会使处理速度减慢到 5 分钟,因为图像太多了。

对于我的生活,我似乎无法弄清楚。

我很惊讶得到这个答案是多么困难,结果是,在

Visual Studio 2015 使用 aspdotnet 核心 Microsoft.NETCore.App 1.1.0 <ExcludeFoldersFromDeployment> 可能 project.json 文件忽略了整个文件。

"publishOptions": {
    "exclude": [
        "wwwroot/media",
        "node_modules"
    ],
    "include": [
        "wwwroot",
        "**/*.cshtml",
        "appsettings.json",
        "web.config"
    ]
},

这就是我最终需要的。