Aspnetcore.docs: globbing pattern not working

Created on 6 Nov 2018  Â·  7Comments  Â·  Source: dotnet/AspNetCore.Docs

the example globbing pattern : "inputFiles": ["wwwroot/**/*(*.css|!(*.min.css))"] does not seem to do anything in .NET Core 2.1. the net effect of this is an empty output file.

@Rick-Anderson Edit: 8K PV, 70% CSAT


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Source - Docs.ms doc-bug

Most helpful comment

The following pattern seems to work for me: "inputFiles": [ "wwwroot/*/!(.min).css" ]

All 7 comments

I've found leaving the parentheses () out, it does work.

@timgroote thanks. Can you post the correct pattern here?

@timgroote thanks. Can you post the correct pattern here?

I'm not sure what version @timgroote is using, but I tried removing the parenthesis, but I am still getting errors for version 2.2:

config:
"outputFileName": "wwwroot/css/site.min.css",
"inputFiles": [ "wwwroot/*/(.css|!(.min.css))" ]

My work around for now is putting the min.css in a folder by itself.
"outputFileName": "wwwroot/css/min/site.min.css",
"inputFiles": [ "wwwroot//.css" ]

Severity Code Description Project File Line Suppression State
Error MSB4018 The "BundlerMinifier.BundlerBuildTask" task failed unexpectedly.
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetExtension(String path)
at BundlerMinifier.Bundle.GetAbsoluteInputFiles(Boolean notifyOnPatternMiss)
at BundlerMinifier.BundleFileProcessor.ProcessBundle(String baseFolder, Bundle bundle)
at BundlerMinifier.BundleFileProcessor.Process(String fileName, IEnumerable`1 bundles)
at BundlerMinifier.BundlerBuildTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() WebApplication8 H:Usersbacon.nugetpackagesbuildbundlerminifier2.8.391buildBuildBundlerMinifier.targets 12

This similar globbing pattern is not working when using globbing in .csproj files to not publish files unless they match a specific pattern. For example, if you only want to publish minified .js files, you should be able to add this to your .csproj file:

<ItemGroup>
    <Content Update="wwwroot/js/**/!(*.min.js)" CopyToPublishDirectory="Never" />
</ItemGroup>

The "!" operator has no effect and all files are still copied to the publish directory.

Visual Studio 2017 v15.9.7
ASPNET Core 2.2

The following pattern seems to work for me: "inputFiles": [ "wwwroot/*/!(.min).css" ]

I don't get it! Why hasn't the authors (or just somebody... ANYBODY) corrected the pattern when it clearly doesn't work! Maybe I'm just pissed because I've wasted a couple of hours on this :-(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danroth27 picture danroth27  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

wgutierrezr picture wgutierrezr  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

davisnw picture davisnw  Â·  3Comments