This project is read-only.


Incorrect match of <file src="..\**" exclude="**\mask">


Algorithm for matching excluded files does not work correctly when "src" path points outside of current directory.

The following definition will not exclude the desired file:
<file src="..\Another**" exclude="\" target="Content\Another" />

The workaround is to incude "..\" in the exclude match:
<file src="..\Another*
" exclude="..*
\" target="Content\Workaround" />

If the proper fix is too difficult, then the user should be at least informed, that the exclude pattern will not work (i.e. if src starts with "..\" and exclude mask starts with "**" then report a warning or an error).

I have attached a simple case for reproducing the bug.

file attachments

Closed Aug 2, 2013 at 12:34 AM by deepakverma
tried and it excludes it now with the fix.


dotnetjunky wrote Jan 22, 2013 at 6:36 PM

We will accept pull request for this bug.

MiroslavBajtos wrote Jan 27, 2013 at 3:30 PM

Apparently the problem is in construction of regex for matching files to exclude, see PackageBuilder.AddFiles() and PackageBuilder.ExcludeFiles().
basePath = "c:\bug\Folder"
source = "..\Another\**"
exclude = "**\"

normalizedExludeWildcard = "c:\bug\Folder\**\"
I am proposing to modify implementation of PathResolver.NormalizeWildcard() so that it ignores basePath for wildcards starting with two asterisks, i.e. the normalizedExludeWildcard will be "*\"

I have also considered modifying PackageBuilder.ExcludeFiles() to modify basePath by applying all leading "..\" elements from AddFiles' source string, but that seems like unnecessary complication to me. (normalizedExludeWildcard would become c:\bug*

MiroslavBajtos wrote Feb 5, 2013 at 8:16 AM

dotnetjunky wrote May 1, 2013 at 12:01 AM

Fixed in changeset c54e5470bf87d003eedc28f3a51546053ed6d91a