I've added Autofac
library using NuGet
and I see it in my references as shown below.
But when I check the properties [F4] of Autofac by clicking on it, it shows empty property box in Visual Studio.
Also, I don't see Autofac
folder under packages
folder.
I see only Package reference in .csproj
file. Then how does it locates the DLL? Where is the actual DLL? I see it's automatically coming inside BIN. How does it come?
Main Issue: Locally I'm able to build the solution but same solution fails on TFS build agents. It's unable to find the NuGet reference. So where can I find DLL references? or how to push it to TFS?
NuGet keeps a configuration file that defines some basic options about how and from where to retrieve these packages: On Windows, the NuGet. config file is kept in %AppData%\NuGet.
Select View in Object Browser. Expand the object that corresponds to your dll. Expand the namespace. Right click the class and select Find All References.
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.
As @magicandre1981 already explained, with PackageReference
style package referencing (as apposed to package.config
-style, also see this for more background on the differences, in case you didn't know), the packages are not located in a per-solution packages-folder, but in a central one (by default %USERPROFILE%\.nuget\packages
). Albeit you can easily change the location using the NUGET_PACKAGES
environment variable (which also works as a TFS Build variable, because they are provided as environment variables to build steps).
Furthermore, inside Visual Studio you see no path, because the actual path to the DLL is determined at build time. You can see part of that path in your <project-dir>\obj\project.assets.json
file (which is generated during the restore
target/operation), but the full path you will only see in the MSBuild logs (for example when actually calling the csc.exe
executable/C# compiler or during ResolveAssembyReferences
-task).
Note that for .NET Core, i.e. "SDK style" projects, the path is actually shown in properties (as are the actual DLLs in a node underneath the "package" node.
One can only assume that the integration of PackageReference in "old" projects is not fully done yet (if ever).
For comparison a PackageReference in an "old" / non-SDK-style project:
You use the new Package Reference where the NuGet files get get stored into a cache:
Solution-local packages folders are no longer used – Packages are now resolved against the user’s cache at
%userdata%\.nuget
, rather than a solution specific packages folder. This makes PackageReference perform faster and consume less disk space by using a shared folder of packages on your workstation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With