You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compress-PSResource was ignoring certain files and folders due to NuGet's default exclusion patterns, causing signature validation failures when modules included file catalogs.
Problem
When compressing a module for publishing, Compress-PSResource was excluding:
Files starting with . (dotfiles like .gitkeep, .gitignore, .editorconfig)
Empty files
Other patterns in NuGet's default exclude list
This caused issues in the following scenario:
A module contains .gitkeep files (empty or non-empty) in directories like Public/ or Private/
A file catalog is generated that includes these files
Compress-PSResource creates a .nupkg but excludes the .gitkeep files
During installation, signature validation fails due to mismatch between the catalog and package contents
Solution
Added NoDefaultExcludes = true to the PackArgs in PublishHelper.cs. This disables NuGet's default file exclusion behavior, ensuring all files in the module directory are included in the compressed package.
Change in src/code/PublishHelper.cs:
varrunner=newPackCommandRunner(newPackArgs{CurrentDirectory=outputDir,OutputDirectory=outputNupkgDir,Path=nuspecFile,Exclude=System.Array.Empty<string>(),Symbols=false,Logger=NullLogger.Instance,NoDefaultExcludes=true// ← Added this line},MSBuildProjectFactory.ProjectCreator,builder);
Verification
Manually tested to confirm:
✅ Empty .gitkeep files are now included
✅ Non-empty .gitkeep files are now included with correct content
✅ Other dotfiles (.gitignore, .editorconfig) are now included
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.
CopilotAI
changed the title
(削除) [WIP] Fix Compress-PSResource to include .gitkeep files (削除ここまで)
(追記) Fix Compress-PSResource ignoring .gitkeep and other dotfiles (追記ここまで)
Oct 7, 2025
I don't really think it's necessary to publish to the Gallery because the issue isn't with publishing it's with the act of packing/compressing. The method PackNupkg() gets called for both Compress-PSResource and Publish-PSResource, so to reduce test redundancy and time it takes to run tests (particularly since the Windows test suite occasionally times out) I think it makes sense to just have 1 test here
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fixes #1882 and #1819
Compress-PSResourcewas ignoring certain files and folders due to NuGet's default exclusion patterns, causing signature validation failures when modules included file catalogs.Problem
When compressing a module for publishing,
Compress-PSResourcewas excluding:.(dotfiles like.gitkeep,.gitignore,.editorconfig)This caused issues in the following scenario:
.gitkeepfiles (empty or non-empty) in directories likePublic/orPrivate/Compress-PSResourcecreates a.nupkgbut excludes the.gitkeepfilesSolution
Added
NoDefaultExcludes = trueto thePackArgsinPublishHelper.cs. This disables NuGet's default file exclusion behavior, ensuring all files in the module directory are included in the compressed package.Change in
src/code/PublishHelper.cs:Verification
Manually tested to confirm:
.gitkeepfiles are now included.gitkeepfiles are now included with correct content.gitignore,.editorconfig) are now included.vscode) are now includedAlso added a test case in
CompressPSResource.Tests.ps1to verify.gitkeepfiles (both empty and non-empty) are included in compressed packages.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/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)37cvsblobprodcus359.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)4myvsblobprodcus32.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)51yvsblobprodcus36.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)5dkvsblobprodcus355.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)7devsblobprodcus323.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)7k6vsblobprodcus337.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)7tjvsblobprodcus341.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)bcnvsblobprodcus378.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)c50vsblobprodcus330.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)c78vsblobprodcus322.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)dlbvsblobprodcus316.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)fdpvsblobprodcus345.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)gbsvsblobprodcus365.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)jd4vsblobprodcus366.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)kh4vsblobprodcus325.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)kmuvsblobprodcus389.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)l49vsblobprodcus358.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)m6xvsblobprodcus342.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)pkvvsblobprodcus321.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)s4uvsblobprodcus326.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)tphvsblobprodcus375.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)uy6vsblobprodcus34.vsblob.vsassets.io/usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish(dns block)yttvsblobprodcus357.vsblob.vsassets.io/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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.