Reputation: 9385
I've got a .nupkg
file, and I'm trying to install it locally on macOS, so that I can run a .net core application that depends on it. How do I do this?
I've installed the dotnet
runtime, mono
and nuget.exe
. I've tried to look at the different nuget install
options, tried things like nuget install <file>.nupkg
, nuget install -Source . <file>
, ... but nothing seems to work; they just tell me that the path is incorrect or show me the command help again. I'd expect it to say something like "installing .nupkg to ~/.nuget/packages".
I read that one of the options that Windows users have is an Install-Package
command that they can use from Powershell, but I'm pretty sure this should be possible with just nuget as well?
I'm somewhat new to .net and .net core development.
I've compiled some .net core code in Windows that depends on a custom library, and I believe I should be able to run the resulting .dll
file on macOS using dotnet
. Instead, I get an error similar to the following:
Error:
An assembly specified in the application dependencies manifest (foo.deps.json) was not found:
package: 'A.B', version: '0.9.5'
path: 'lib/netstandard1.3/A.B.dll'
I think I misunderstood the purpose of the .nupkg
files; I now think they're only used during development, and not for running the code (the dependencies for running the code seem to be packaged as .dll
s, as the error message above says).
I solved the error above by publishing the project (dotnet publish
), and then I can run the resulting .dll
using dotnet ./path/to/publish/foo.dll
; the dependencies end up being copied into the publish
folder.
I still had issues figuring out how to install the .nupkg
s for development, so I'm grateful for the accepted answer.
Upvotes: 1
Views: 4295
Reputation: 24589
Try this one
dotnet add package A.B -s "<here_your_path_to_nupkg>"
Or add local source like
nuget sources add -name FeedName -Source "<here_your_path_to_nupkg>"
then
dotnet add package A.B -s FeedName
Upvotes: 2