2

is there are way to use nuget Packages with dotnet on a raspberry PI without Internet? I have installed dotnet SDK on a raspberry PI. I have also installed nuget CLI on raspberry PI. I am using nuget CLI with mono. I followed the second Answer from this Question : dotnet add package with local package file

I created a feed from package. When I enter:

dotnet add package MyPackage -s ./packages

I get this as output:

Writing /tmp/tmp3Ax5wm.tmp
info: Adding PackageRefernce for package 'system.device.gpio' into project '/home/pi/ws/dotnet/testapp.csproject'.
info: Restoring packages for /home/pi/ws/dotnet/testapp.csproject...
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error: Resource temporarily unavailable

Somebody has an idea? I coppied the .nupkg with a usb stick on the raspberry pi. Maybe running a nuget Server on the raspberry pi and push it the local server and install it from there? For example https://github.com/ai-traders/liget ? Is there a easy way to solve the problem?

otto
  • 1,815
  • 7
  • 37
  • 63
  • 1
    Note, this is a question, not at all an answer or to be understood as anything related to an answer, so here goes: Why did you execute `dotnet add` on the RPI? Can it compile code? As far as I was aware of, the SDK's wasn't available for the RPI yet. I thought you had to compile code on a platform that allowed the SDKs, such as Windows, and then copy already compiled assemblies to the RPI. – Lasse V. Karlsen Sep 07 '19 at 21:44
  • dotnet SDK is avaiable on raspberry PI. You can build even on raspberry PI. It tooks a bit longer then on windows – otto Sep 07 '19 at 21:50
  • I think there is a way to create a local cache of nuget packages, at least on Windows, have you considered that approach? I am probably talking out of my ass right now though.... – Lasse V. Karlsen Sep 07 '19 at 21:53
  • Doesnt know what you exactly mean... – otto Sep 07 '19 at 21:54
  • 1
    A nuget package is one of two things; it is either the response of sending a request to a nuget repository web system, or a `.nupkg` file found somewhere. You can create a local folder, download and store a bunch of `.nupkg` files in there and instruct Nuget to use that folder as a source. If packages needed are found in that local folder, they will not be attempted downloaded over the internet. – Lasse V. Karlsen Sep 07 '19 at 21:56
  • yes I have tried it. For whatever reason nuget wants to get this json from the internet https://api.nuget.org/v3/index.json even though I downloaded the .nupkg file – otto Sep 07 '19 at 22:00

2 Answers2

0

I would recommend you add directory with all your packages you need as a local file share. Then you just need to define that local file share as a source in a nuget.config file at the root of your app. Then when you run the command it will check that file share for the package. Much easier to implement then having to host a nuget server.

Here are some docs on it: https://learn.microsoft.com/en-us/nuget/hosting-packages/local-feeds

Jamie
  • 3,094
  • 1
  • 18
  • 28
-2

I would recommend you to not use the .Net core SDK on your raspberry but .Net core Runtime then you can develope your .Net core app on a real PC and publish to a publish folder. During publish .Net core restores all DLLs of nuget packages into the publish folder. After that you can easily copy paste your publish folder on your raspberry and start your app with dotnet yourpath/yourApplicationName.dll in Linux-cli or execute for windows the application.exe in the publish folder.

Fabian Kamp
  • 129
  • 10