PowerShell / PowerShell/PSResourceGet
Set or expose the NoDefaultExcludes nuget parameter in Publish-Module
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 576
- Forks
- 114
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 7
Beschreibung
Summary of the new feature / enhancement
nuget pack (and by transition dotnet pack and Publish-Module) have a default behaviour of ignoring *.nuspec files and .* files and folders. As a result, when publishing PowerShell modules those files also get ignored, which can get in the way depending of what your workflow is (in my case, I'm trying to ship a default ExifTool configuration file).
This can be overriden in nuget and dotnet pack with the CLI switch / csproj property NoDefaultExcludes. The way Publish-Module works though, there is no way to override this, as the module creates a temporary csproj file which the module user has no control over.
It would be nice to set or at least expose this switch in the Publish-Module Cmdlet.
More info:
The verbose logging from Publish-Module when the folder contains a filtered file:
VERBOSE: C:\Program Files\dotnet\sdk\6.0.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): warning NU5119: File 'C:\Users\xxx\AppData\Local\Temp\222345117\GFK.Image\ExifTool\.ExifTool_config' was
not added to the package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file, use -NoDefaultExcludes from the commandline [C:\Users\xxx\AppData\Local\Temp\cba5a149-c53d-420c-9
6ff-bb9c4a63df02\Temp.csproj]
Proposed technical implementation details (optional)
I was able to publish a module including those files by modifying the PowerShellGet module on my local environment myself as follows (specifically the <NoDefaultExcludes>true</NoDefaultExcludes> bit). Feels like it would just be a matter of condtionally control this with a Cmdlet switch parameter.
$CsprojContent = @"
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>NotUsed</AssemblyName>
<Description>Temp project used for creating nupkg file.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>true</IsPackable>
<NoDefaultExcludes>true</NoDefaultExcludes>
</PropertyGroup>
</Project>
"@
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne beim Publish-Module-Cmdlet und dem im Issue beschriebenen temporären csproj-Inhalt und verfolge dann, wie Cmdlet-Parameter an dieses Projekt übergeben werden. Die Arbeit ist abgeschlossen, wenn Publish-Module NoDefaultExcludes bedingt verfügbar machen oder setzen und Paketdateien wie .ExifTool_config ohne die standardmäßige Ausschlusswarnung einschließen kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- powershell
- Bereich
- cli, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100