I'm setting up an private NuGet server for testing purposes, but want to use it later for a place to get scripts from.
I don't completely understand how to pack a Powershell file to the NuGet. According to the documentation I need to use either the .nupkg file, which does not contain any references to the script I want to package (Unless I put dependency in there?)
Could anyone direct me towards a resource where it explains how to pack a Powershell script? I've tried to find help articles but to no avail.
You can use the Publish-* cmdlets, which call into nuget.exe and build the nuspec file (which nuget uses to create the nupkg file) and publish to the gallery. Before you can publish to your private NuGet Server, you need to register it as a repo with Register-PsRepository. Something like this for example:
Register-PSRepository -Name "TestPsGallery" `
If you want to publish modules, you need to add the SourceLocation and PublishLocation parameters to the Register-PsRepository command. Once your repository is registered, you can use it like any other NuGet repo to publish and install scripts and modules to.
Publish-Script -Path PathToScript -Repository TestPsGallery -NuGetApiKey ApiKey
I ended up doing above, however before I read your post. It wasn't very clear that you could do that.
You must be logged in to reply to this topic.