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

时间:2017-01-31 23:56:50

标签: visual-studio .net-core pubxml

在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分钟,因为图像太多了。

对于我的生活,我似乎无法弄明白。

1 个答案:

答案 0 :(得分:0)

令我惊讶的是,在

中得到这个答案是多么困难

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"
    ]
},

这就是我最终需要的。