I've got a project that relies on an obsolete (no longer available through Nuget.org) version of System.Data.Sqlite (v1.12) due to later versions dropping their support for RC4 encrypted databases after that point.
I'm trying to spin up a new project in Visual Studio that similarly relies on the same versions of the packages, but merely copying the same elements from the old .proj file and copying the packages.config and packages folder from the old project does not result in a project that contains those nuget packages (as seen in Visual Studio's "Manage Nuget Packages").
Where are the actual references to Nuget packages stored for a project? And is it possible to hand-edit a file to add them in? (Since in my case, it's not possible to add them through the Nuget Package Manager interface, as the online source is no longer available).
Thanks for any help you can offer!
Where are the actual references to Nuget packages stored for a project?
The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference
format always use packages directly from this folder. When using the packages.config
, packages are installed to the global-packages folder, then copied into the project's packages folder.
If you use packages.config
file in your project, when you restore these packages, you can specify the folder in which packages are installed.
Since it is impossible to add this package from online source(Nuget.org), you can install this old package from your local feed. Please check the following steps:
1.Create a folder to store your nuget packages and put System.Data.Sqlite
into the folder.(testpackages).This is your local feed. You can install packages from here later instead of nuget.org
.
"c:\testpackages"
2 Open Nuget.config
file and add a custom package source.
Windows: %appdata%\NuGet\NuGet.Config
<packageSources>
<!-- <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> -->
<add key="Test Source" value="c:\testpackages" />
</packageSources>
3.Add your package.config
file in your project root. And run the following command
nuget restore packages.config -PackagesDirectory Packages
For more information, please read Nuget restore CLI
4.The packages will be installed to your Packages
folder in your project. Then open your .csproj file and add a reference to your package like this:
<Reference Include="Newtonsoft.Json">
<HintPath>Packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Also you can do it in the Nuget package Manager
Hope it can help you.