Closed pauby closed 4 years ago
I've created a PR for this to demonstrate the code. Unfortunately the -Exclude
parameter in Get-ChildItem
has been broken for a while (I tried it again for this PR just in case anything has changed from the last time I pulled my hair out over it and it hasn't) so I had to resort to the Where
clause. However it does allow the user to specify regular expression(s) to match the files whcih I think is better. However this does require two ways of working:
is
$truethen
$PSBPreference.Build.Exclude` should be regular expressions;$PSBPreference.Build.CompileModule
is $false
then $PSBPreference.Build.Exclude
should just be an array of file names (as these are passed to Copy-Item further down the code).I would rather we stuck with one or the other so would welcome a discussion on that.
When
$PSBPreference.Build.CompileModule
is$true
the$PSBPreference.Build.Exclude
is ignored and all.ps1
files found are used in the PSM1 file.Expected Behavior
The files to be excluded in the
$PSBPreference.Build.Exclude
is honoured and the files are excluded from being compiled into the PSM1 file.Current Behavior
When
$PSBPreference.Build.CompileModule
is$true
the$PSBPreference.Build.Exclude
is ignored and all.ps1
files found are used in the PSM1 file.Possible Solution
The files are excluded.
Steps to Reproduce (for bugs)
Note you need to setup a proper build for this. These steps are those things that must be set / done:
$PSBPreference.Build.Exclude
to a file to be excluded;$PSBPreference.Build.CompileModule
to $trueContext
I am trying to exclude a folder of files from being compiled into the PSM1 file.
Your Environment