Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Import-Module should support nupkg files #7259
The goal here is for manual module install instructions to just be:
This seems like an obvious next step in the ease-of-use story for cross-platform modules. PowerShell should inherently support nupkg files similar to the way the
Not only would this reduce the disk space needed for modules that are installed but infrequently used, it would make installing modules via sneaker-net so much easier: no need to manually figure out the folder paths! No more explaining that...
Bonus points if you implement it with .nupkg and also .psmodule so that we can implement file-type association for "install" in Windows (i.e. if you download a .psmodule and double-click, PowerShell will put it in your user scope location).
If it were up to me, @jakerobinson, you'd get a warning during install for each dependency you didn't already have installed.
It could also support finding them as files in the same folder as the one you're installing, in which case it would be as user friendly as if you'd configured the folder as a repository.
Thinking some more about this: #6724 (which I created) is not just related, it is an
It suggests integrating the NuGet-package support into
Given that NuGet packages aren't PS modules, but general-purpose .NET assemblies, integration with
# Install a NuGet package from the NuGet Gallery and add its types to the session. Install-Package -Provider nuget Mono.Posix.NETStandard | Add-Type # Add the types of an already installed NuGet package to the session. Add-Type -Package Mono.Posix.NETStandard # Equivalent, via Get-Package. Get-Package Mono.Posix.NETStandard | Add-Type
If you wanted to add NuGet packages manually, you'd have to place them in one of those locations.
The logic to automatically unpack a
Separately or alternatively, if keeping platform-inapplicable files never makes sense,
I agree that we should load assemblies from nupkg @mklement0, but it's not an alternative, it's solving a different set of problems (including the cross-platform ones which I also raised when I asked for it, in #3091
However, about PowerShell modules. They are shipped in
So this request is to support importing modules from nupkg without pre-extracting them. I.e. extract them on demand the way