question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publishing with publish-psresource requires specific folder name [3.0.0-beta10]

See original GitHub issue

When using publish-psresource, the folder/directory name must be the same as the directory folder, and publishing from a folder with the version name will result in an error

Example:

gh:\psrapid\psrAPId> publish-psresource -path C:\Users\adrian.andersson\git\psrapid\psrAPId\1.0.1\psrAPId.psd1 -Repository powershellgetbeta -Credential $pshelf.credential -APIKey $pshelf.NuGetApiKey -verbose
Publish-PSResource: Value cannot be null. (Parameter 'path')
[14:28 | 0.02]
gh:\psrapid\psrAPId> publish-psresource -path C:\Users\adrian.andersson\git\psrapid\psrAPId\1.0.1\ -Repository powershellgetbeta -Credential $pshelf.credential -APIKey $pshelf.NuGetApiKey -verbose
Publish-PSResource: No file with a .psd1 extension was found in C:\Users\adrian.andersson\git\psrapid\psrAPId\1.0.1\1.0.1.psd1.  Please specify a path to a valid modulemanifest.

Works fine if the folder name matches the psd1 name. Seems its parsing the folder name and searching for a manifest file using that name, which makes having a versioned release folder a bit more complicated

Bonus Oddness: It is possible to omit the repository name and publish-psresource will not throw an error, even if there are multiple repositories with the same priority weight

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mgreenegitcommented, Apr 22, 2022

Confirmed. Repro: Module file name - AzureConnectedMachineDsc.psd1 Publish-PSResource -ApiKey ‘***’ -Repository PSGallery -Path ‘/Users/username/git/AzCMAgentPublish/’ -Verbose Publish-PSResource: Value cannot be null. (Parameter ‘path’)

I was using a different folder name because I don’t want to publish every file I use in my local testing/development folder.

It doesn’t seem like a good practice to require assumptions about the folder name/structure. At minimum, the error message does not indicate what the user needs to do, so that could be corrected.

0reactions
Jaykulcommented, Jul 18, 2022

It’s broken the other way too. I used to publish with folder name:

Publish-PSResource -Path C:\Users\Jaykul\Projects\Modules\TerminalBlocks\1.0.0

Now it expects the file to be named 1.0.0 instead of “TerminalBlocks.psd1”:

Publish-PSResource: No file with a .psd1 extension was found in C:\Users\Jaykul\Projects\Modules\TerminalBlocks\1.0.0\1.0.0.psd1.  Please specify a path to a valid modulemanifest.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing with publish-psresource requires specific folder ...
When using publish-psresource, the folder/directory name must be the same as the directory folder, and publishing from a folder with the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found