PowerShell / PowerShell/PSResourceGet

Set or expose the NoDefaultExcludes nuget parameter in Publish-Module

Aperta
#625 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-nupkg Area-Publish feature_request
Lingua principale
C#
Stelle
576
Fork
114
Merge medio
1g 2h
PR unite (30g)
7

Descrizione

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>
"@

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal cmdlet Publish-Module e dal contenuto temporaneo di csproj descritto nell’issue, quindi segui il modo in cui i parametri del cmdlet vengono passati a quel progetto. Il lavoro è completato quando Publish-Module può esporre o impostare condizionalmente NoDefaultExcludes e includere nel pacchetto file come .ExifTool_config senza l’avviso di esclusione predefinita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
cli, tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.