Keep local copy of Nuget Package in VS Code

388 Views Asked by At

In Visual Studio Code, i would like to keep a local copy of a referenced Nuget package in the project folder for the case the package will not be available online for some reason in the future.

nuget restore shall still be able to download it from the internet if the local copy is not yet there.

I think thats exactly the behaviour with Visual Studio, but i can't get this running with Visual Studio Code

1

There are 1 best solutions below

0
gerthmar On

I think i found a solution myself.

Adding a file called nuget.config with the following content to the project folder does exactly what I wanted. The packages are now put into the local packages folder.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
    <add key="globalPackagesFolder" value="packages" />
    <add key="repositoryPath" value="packages" />
</config>
</configuration>