Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does NuGet put the DLL file?

I am trying to work around NuGet's source control limitations.

To that end I need to know a bit more about how NuGet works. Let’s take a simple example. Say I have a project and I add AutoMapper to it. When I add it, where is the DLL file supposed to be put?

I ask because it does not seem to be consistent. Sometimes the reference is looking for the DLL file the "Packages" folder:

NuGet using packages path

And sometimes it is looking in the Debug build output folder:

NuGet using the 'Debug' path

But in both cases the AutoMapper line in the packages.config file is the same:

First example:

<?xml version="1.0" encoding="utf-8"?> <packages>   <package id="AutoMapper" version="1.1.0.118" />   <package id="CommonServiceLocator" version="1.0" />   <package id="Unity" version="2.1.505.0" /> </packages> 

Second example:

<?xml version="1.0" encoding="utf-8"?> <packages>   <package id="NSubstitute" version="1.1.0.0" />   <package id="AutoMapper" version="1.1.0.118" />   <package id="CommonServiceLocator" version="1.0" />   <package id="Unity" version="2.1.505.0" /> </packages> 

So what is controlling where it sets up up the reference to? And how do I make it just use the Packages Location?

(When it uses the Debug output folder those references fail if you to compile for "Release".)

Frustrated Note: I have to admit that I am finding NuGet to be a cool idea, but it is not ready for anything but simple situations. (I am thinking about just going back to having a library folder with all my DLL files in it.)

I can't help but wonder if I am missing something because NuGet has such wide spread adoption. There must be some way to make this work...

like image 367
Vaccano Avatar asked Aug 10 '11 22:08

Vaccano


People also ask

Where are DLL files located Visual Studio?

Dll files are located in C:\Windows\System32. Do run the full scan of Defender or third party antivirus if you have.

Is a NuGet package a DLL?

Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.


1 Answers

.NET Core

In .NET Core, NuGet packages are now stored in a global location, by default:

Windows: %userprofile%\.nuget\packages (AKA C:\Users\[User]\.nuget\packages)

Linux: ~/.nuget/packages

Additionally, the packages.config was removed with references now being stored using the <PackageReference> element in the .csproj file.

You can find out more documentation here.


If you can't find the global location, it may have been changed. You can discover it using this command:

dotnet nuget locals global-packages --list 

If you would like to change the package location to, for example, e:\packages, you can use the following command.

dotnet nuget config -Set globalPackagesFolder=e:\packages 

Any problems installing NuGet packages that I've had have always been fixed by clearing all the cache locations (there are additional places where NuGet packages are saved aside from the global location) like so:

dotnet nuget locals all --clear 
like image 103
Hazza Avatar answered Oct 23 '22 13:10

Hazza