Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet run/build - How to specify where the packages are?

Since I am using CI integration I cannot (and don't want) to put packages to shared user folder. Instead I want them restore inside the actual folder (think node_modules).

So that is simple, I run dotnet restore --no-cache --packages Packages and it works fine. Packages are restored and they are in the correct folder.

However when I run dotnet build -c Release or dotnet run -c Release it cannot find no packages.

/var/www/website/project.json(15,50): error NU1001: The dependency Microsoft.AspNetCore.Hosting >= 1.0.0 could not be resolved.

So how to make sure dotnet knows where to look for packages for this specific project?

Here is how my folders look like where I execute the commands.

bin
bundleconfig.json
NuGet.config
Packages
project.json
Properties
web.config
bower.json
Controllers
obj
Program.cs
project.lock.json
ViewsWeb.xproj
like image 906
Stan Avatar asked Nov 08 '22 06:11

Stan


1 Answers

Okey, so for now there is no such option and actually --packages seems to be some legacy parameter.

Anyway, in order to make it work we need to set env variable NUGET_PACKAGES=/var/www/website/Packages

Of course this sucks in a way that I cannot set it globally, however I can set it per process (if, for example I start app with systemd).

like image 118
Stan Avatar answered Jan 04 '23 02:01

Stan