With classic .Net projects, if I added a reference to a NuGet package, it would get downloaded to a packages folder and I could check that into source control along with the rest of my code. This allowed any developer to download the code, along with the NuGet packages, without having to set up a package source to separately download the packages. This is not how .Net Core projects work. There does not seem to be a packages folder for the solution, and it is up to each developer to set up the custom package source and download the packages when they get the code. Is there a way to configure the .Net Core project to do like the classic .Net projects did and manage a packages folder?
You still have packages folder in your .NET Core solution, but the global packages are located at: C:\Users\ [YourUsername]\.nuget\packages You can check out a question I asked to see if the answers do you any good. How do I include NuGet packages in my solution for .Net Core projects?
The NuGet Package Manager UI in Visual Studio for Mac allows you to easily install, uninstall, and update NuGet packages in projects and solutions. You can search for and add packages to your.NET Core, ASP.NET Core, and Xamarin projects.
The Nuget package contains only ConsumerLibraryProj3.dll. I verified the above settings for a .NET Standard project and it works. But for .NET Framework type project I'm unable to get it done. Any help will be appreciated.
Add the Newtonsoft.Json NuGet package To install the package, you can use either the NuGet Package Manager or the Package Manager Console. When you install a package, NuGet records the dependency in either your project file or a packages.config file (depending on the project format).
A lot of NuGet behaviour can be controlled via NuGet.Config
files (See this reference for more details)
If you place a NuGet.Config
file next to the solution with the following content, you can override the location that the packages will be restored into:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
</configuration>
If the problem is that you'd need to set up additional sources in VS on every machine, you can also add those sources via a NuGet.Config in your repository so VS will pick up the feeds to use when opening a solution:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="CompanyFeed" value="https://my.company.com/private/nuget" />
</packageSources>
</configuration>
If you have no feed to host packages and need to include packages with the solution, you can use a directory containing .nupkg
files as well in NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local" value=".\NuGetPackages" />
</packageSources>
</configuration>
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