visual-studio.net-corepubxml

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


In VS 2015, on a web project, I have this as my *.pubxml file

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

and not one of those rules are taking. If I watch \AppData\Local\Temp\PublishTemp\PROJECT_NAME I see the folder copied in there along with the files. All i need to do is not send the media folder over to the server because it slow the process to like 5 mins because there are so many images.

For the life of my I can't seem to figure it out.


Solution

  • It was amazing to me how hard it was to get this answer, Turns out, in

    Visual Studio 2015 using aspdotnet core Microsoft.NETCore.App 1.1.0 <ExcludeFoldersFromDeployment> and maybe the whole of the file was ignored for the project.json file.

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

    That was all I needed in the end.