How do I get my packages.config folder back where it was?
If you do not absolutely need packages.config
, then do not go back. The PackageReference
format offers lots of benefits that you do not want to miss in the long run, your link does not lie. It even solves your next problem.
How do I Uninstall the packages I did not install?
You simply don't, because it will break your library. A NuGet package represents a module or set of features consisting of artifacts like assemblies, content files or build scripts. Such a module may have dependencies that it requires to work, for example an SQLite library. Instead of creating one giant archive that contains all assemblies and files that are required, packages specify dependencies to other packages. This way, you can flexibly consolidate and update packages, especially if there are common dependencies of multiple packages, which also prevents having multiple copies of the same assemblies or files in different versions, which can become problematic.
Let's look at the dependencies of the packages that you are using.
- System.Data.SQLite.Core
- WeCantSpell.Hunspell
- System.Memory for .NET Framework >= 4.5
[...] the only package installed was System Data SQLite Core
This package does not have any dependencies, that is why there were not additional packages.
[...] I only installed System Data SQLite Core and WeCantSpell.Hunspell
If you look at the list above, the Hunspell package requires System.Memory
, that explains why it is installed, too. Hunspell will not work without it, it depends on it. I hear you ask, where do the other packages come from then? Each package can have dependencies. Consequently a package can depend on a package that depends on other packages that... I think you get the idea. So let's take another look at dependencies for .NET Framework >= 4.6.1.
- System.Memory
- System.Buffers
- System.Numerics.Vectors
- System.Runtime.CompilerServices.Unsafe
I think that these are all the dependencies that you were looking for. All these packages will be added to your packages.config
and this is one good reason to migrate to PackageReference
, because it handles transitive package references way better. Suppose you add one package A
with a dependency to package B
and that has a dependency to package C
. Then A
has a dependency to C
. This is called a transitive dependency.
The older packages.config
will add all packages, while PackageReferece
will only add A
and is smart enough include the other packages, without explicitly adding them. In your example, the project file would only contain the references below.
<PackageReference Include="System.Data.SQLite.Core">
<Version>1.0.113.1</Version>
</PackageReference>
<PackageReference Include="WeCantSpell.Hunspell">
<Version>3.0.1</Version>
</PackageReference>