Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 7, 2025

Issue

Compress-PSResource was ignoring files and folders when creating .nupkg packages, specifically:

  • Empty .gitkeep files
  • Non-empty .gitkeep files
  • Other hidden files (starting with .)

This caused signature verification failures when a file catalog included these files but they were missing from the compressed package.

Root Cause

NuGet's PackCommandRunner applies default exclusions when packing, including:

  • Empty files (0 bytes)
  • Hidden files (files starting with .)
  • Empty directories

The CreateNuspec() method was generating .nuspec files without an explicit <files> section, causing NuGet to apply these default exclusions.

Solution

Modified CreateNuspec() in PublishHelper.cs to add an explicit <files> section to the generated .nuspec:

<files>
  <file src="**" target="" />
</files>

This overrides NuGet's default exclusions and ensures all files are included in the package, including .gitkeep files and other hidden files.

Testing

Added comprehensive test case "Compress-PSResource includes .gitkeep files and empty files" that:

  1. Creates a module with Public and Private directories
  2. Adds an empty .gitkeep file in Public
  3. Adds a non-empty .gitkeep file in Private
  4. Compresses the module
  5. Extracts and verifies both .gitkeep files are present in the package

Impact

  • Positive: Fixes signature verification failures and ensures all module files are preserved in packages
  • Side effect: Packages will now include any hidden files present in the module directory (e.g., .DS_Store if present), making the behavior more predictable and transparent
  • Compatibility: No breaking changes - this only makes the compression more inclusive

Fixes #[issue_number]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1k9vsblobprodcus379.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 37cvsblobprodcus359.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 4myvsblobprodcus32.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 51yvsblobprodcus36.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 5dkvsblobprodcus355.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 7devsblobprodcus323.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 7k6vsblobprodcus337.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 7tjvsblobprodcus341.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 96bvsblobprodcus338.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • bcnvsblobprodcus378.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • c50vsblobprodcus330.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • c78vsblobprodcus322.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • dlbvsblobprodcus316.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • fdpvsblobprodcus345.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • gbsvsblobprodcus365.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • kh4vsblobprodcus325.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • kmuvsblobprodcus389.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • m6xvsblobprodcus342.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • pkvvsblobprodcus321.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • s4uvsblobprodcus326.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • tphvsblobprodcus375.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • yttvsblobprodcus357.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Compress-PSResource ignores files and folders</issue_title>
<issue_description>### Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Compress-PSResource completely ignored and didn't compress following paths while preparing a module for publishing:

  • Public\.gitkeep # the folder contiain only this file, and the file IS empty
  • Private\.gitkeep # the folder contiain only this file, and the file IS NOT empty

Previous pipeline step generated file catalog for the module, with the two pats included, and published module failed installing as there was signature mismatch.

The issue is probably related to #1819

Expected behavior

All files and folders are compressed and part of the nupkg file

Actual behavior

Certain paths get ignored

Error details

Environment data

-

Visuals

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1882

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits October 7, 2025 18:40
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Fix Compress-PSResource to include ignored files Fix Compress-PSResource ignoring .gitkeep and empty files Oct 7, 2025
@Copilot Copilot AI requested a review from alerickson October 7, 2025 18:57
Copilot finished work on behalf of alerickson October 7, 2025 18:57
@alerickson alerickson closed this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compress-PSResource ignores files and folders
2 participants