Questions tagged [nuget-package]
NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.
3,725
questions
630
votes
12
answers
460k
views
How can I clear the NuGet package cache using the command line?
I can clear my development computer's NuGet package cache using Visual Studio menu Tools → Options → NuGet Package Manager → General: Clear Package Cache button.
I would like to ...
409
votes
5
answers
255k
views
How can I install an older version of a package via NuGet?
I want to install an older version of a package (Newtonsoft.Json). But NuGet rolls back:
PM> Install-Package Newtonsoft.Json -Version 4.0.5
Successfully installed 'Newtonsoft.Json 4.0.5'.
Install ...
326
votes
19
answers
295k
views
Is it possible to change the location of packages for NuGet?
I have the following convention for most of my projects:
/src
/Solution.sln
/SolutionFolder
/Project1
/Project2
/etc..
/lib
/Moq
moq.dll
license....
324
votes
13
answers
479k
views
Install a Nuget package in Visual Studio Code
How can I install a Nuget Package in Visual Studio Code? I know in Visual Studio, we can do this through the Nuget Package Manager console, but how do I do it in VS Code?
178
votes
34
answers
126k
views
Can't install nuget package because of "Failed to initialize the PowerShell host"
All of a sudden, I am getting this error when upgrading Nuget packages. None of the fixes that I have come across work. I am using Visual Studio 2013.
'Newtonsoft.Json 6.0.3' already installed.
...
170
votes
14
answers
281k
views
'nuget' is not recognized but other nuget commands working
I am trying to create a nuget package using http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory
as a reference.
My Package Manger ...
166
votes
6
answers
72k
views
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to... web.config issue
I am getting the following error:
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
originates from 'System....
159
votes
2
answers
53k
views
What are .NET Platform Extensions on docs.microsoft.com?
There is a framework-level navigation element at Microsoft Docs called ".NET Platform Extensions". It contains docs on recently added APIs like System.IO.Pipelines and System.Threading.Channels for ...
153
votes
14
answers
109k
views
Setting up a common nuget packages folder for all solutions when some projects are included in multiple solutions
I have been using NuGet to retrieve packages from external and internal package sources, which is very convenient. But I have realized that the packages are by default stored per solution, which is ...
146
votes
10
answers
74k
views
Add native files from NuGet package to project output directory
I'm trying to create NuGet package for a .Net assembly which does pinvoke to a native win32 dll.
I need to pack both the assembly and the native dll with the assembly added to the project references (...
132
votes
9
answers
100k
views
How to debug code in NuGet package created by me
I have a NuGet package I created and installed in another solution but now I need to debug the code of the package when called from my new solution.
I tried referencing the solution of the package but ...
130
votes
5
answers
76k
views
How can I use NuGet packages in my Azure Functions?
Using Azure Functions, can I reference and use NuGet packages in my C# function?
128
votes
6
answers
137k
views
Build NuGet Package automatically including referenced dependencies
I want to run a local/internal NuGet repository. I think I've figured out how to "reuse" existing NuGet packages by including them in a dummy project using NuGet and scanning the package file to grab ...
127
votes
3
answers
30k
views
How do you include Xml Docs for a class library in a NuGet package?
I am creating a NuGet package for a C# class library, and I would like to include generated Xml Documentation with the library. This is my nuspec file:
<?xml version="1.0" encoding="...
117
votes
4
answers
36k
views
NuGet Package Manager errors when trying to update
Opening VS2010 today, the extension manager notified me of an update for NuGet Package Manager.
During the install, I get an 'Installation Failed' with an option to view the log.
The key error ...
107
votes
6
answers
324k
views
How to connect to MySQL Database?
New to C# programming, I'd like to be able to access MySQL Databases.
I know MySQL connector/NET and MySQL for Visual Studio are required for C# development.
Do I need to install them into my app?
...
93
votes
4
answers
64k
views
How to specify specific dependency version in nuspec?
I'm creating my first nuget package. I added a dependency with a version that is not the latest version. However, I don't want to update to the latest version of this dependency. Is it possible to ...
90
votes
8
answers
33k
views
Package is not found in the following primary source
I have a build pipeline set up to create Nuget packages and publish them to a feed in artifacts.
I was able to use the feed successfully.
However when I ran the pipeline again, causing the packages ...
88
votes
7
answers
41k
views
How can I make my managed NuGet package support C++/CLI projects?
I have made a NuGet package that works well when I use it from a C# project. It contains a DLL in the lib/net40 directory, and the DLL gets added as a reference.
Now that NuGet supports C++, how do I ...
82
votes
14
answers
110k
views
An assembly specified in the application dependencies manifest (...) was not found
I upgraded Microsoft.AspNetCore from 2.0.3 to 2.0.5 and my WebAPI project, although running successfully locally, fails to start in production (IIS). Everything was fine in production until this ...
81
votes
3
answers
109k
views
Is there a way to download packages from nuget.org then do an offline installation into Visual Studio?
My visual studio is installed on a machine which doesn't have internet connection so I can't download and install packages from NuGet Manager in VS.
So I am looking for a way to use another machine ...
75
votes
22
answers
93k
views
The EntityFramework package is not installed on project
I am having trouble getting the EF to install on my very simple project called 'Match' (just now learning MVC, better late than never). The general context here is that I created the Model class with ...
75
votes
1
answer
41k
views
What does PrivateAssets='All' mean?
When I build my .NET Core (NETStandard v2.0) project I am getting the following warning:
ViewModels: [FodyPackageReference] Fody: The package reference for PropertyChanged.Fody
does not contain ...
73
votes
2
answers
15k
views
NuGet scripts to different directory
Nuget packages download Javascript files to ~/Scripts
I prefer to keep my content organized in a ~/content folder, which contains
~/content/css
~/content/images
~/content/scripts
~/content/scripts/...
68
votes
5
answers
44k
views
Set content files to "copy local : always" in a nuget package
I generate a nuget package from a project with this command in the post-build event. the variable %conf% is set to the right configuration (debug or release) and %1 is the project name (e.g. "...
68
votes
7
answers
14k
views
Pain-free local development while also referencing NuGet packages
I am attempting to publish and consume versioned NuGet packages of class libraries while avoiding headaches for local development. Here is a sample Visual Studio solution layout:
| Libraries
| ...
63
votes
9
answers
30k
views
Automating creating NuGet package as part of build process
I have an automated build process that I'd like to extend so I can build the libraries I am distributing via NuGet. Currently, running nuget.exe to create the packages is a manual operation.
What is ...
61
votes
6
answers
46k
views
Don't include dependencies from packages.config file when creating NuGet package
I am using Nuget to create packages. I would like to create a package which does not contain any dependencies (in the .nuspec) file to any other NuGet packages. My project does have NuGet package ...
59
votes
8
answers
17k
views
How to remove a specific version of a package on a TeamCity Nuget Feed?
Does anyone know to remove a specific version of a package on a TeamCity Nuget Feed?
58
votes
8
answers
57k
views
NuGet Assembly outside lib folder
I'm going to bang out a couple of questions here...first, with NuGet is it possible to create a package from a few DLLs? There is no visual studio project, just the command line and a couple of pre-...
56
votes
15
answers
42k
views
MVC bootstrap navbar not working after running NuGet updates
An MVC app broke after we updated all the NuGet packages. After trying everything I created a new MVC app, updated the NuGet packages and the basic navbar...
<div class="navbar navbar-inverse ...
55
votes
13
answers
206k
views
Could not install package '--'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5'
I created this package, I need it in a project but couldn't install it, this error appears:
Could not install package 'Mshwf.NiceLinq 1.0.9'. You are trying to
install this package into a project ...
55
votes
9
answers
28k
views
Microsoft.AspNetCore.App 2.1.1 upgrade "Blocked by project"
I'm trying to upgrade a .net core 2.1 project to the latest version of Nuget packages such as Microsoft.Extensions.DependencyInjection.Abstractions 2.1.1.
However this is blocked by the package ...
53
votes
3
answers
16k
views
Automatic native and managed DLLs extracting from Nuget Package
This is driving me crazy for several months now and I'm still not able to achieve it. My managed libraries are extracted from the Nuget package but not the natives ones.
We have a bunch of managed and ...
52
votes
14
answers
48k
views
Nuget Package - feed (VSTS) :Exception 'System.AggregateException' thrown when trying to add source
I have created a new feed with in Package Release hub (VSTS), installed the credentials, then added the package source.
Now, I am using Visual Studio 2015 to install Micrososft.Aspnet.mvc to a ...
51
votes
3
answers
29k
views
How to automatically update NuGet packages to latest available version
I have two repositories, and I need compiled libraries from one repository in the other. I don't want to manually check repo1 for updated libraries, and copy/commit to repo2, because that is stupid. I'...
50
votes
5
answers
12k
views
How to find out which .NET framework nuget package targets?
I have C# project that has to target .NET 3.5. framework and I have several nuget packages I'd like to install in the given project.
How to find out, for a given nuget package, which .NET framework ...
49
votes
9
answers
74k
views
Nuget package installed but references not resolved
I have a multi-project solution with Prism Nuget packages installed in several projects. I then attempted to add a Prism Mef extensions package to one of the projects using the Nuget Package Manager ...
49
votes
5
answers
45k
views
Updating nuget packages in all projects in a solution
I have a .net solution (say A) with multiple projects(say B,C,D). I want to update all nuget packages for all projects in the solution. I know I can update nuget packages using command line but ...
49
votes
3
answers
18k
views
Command Line Parser Library - Boolean Parameter
I try to pass a boolean parameter to a console application and process the value with the Command Line Parser Library.
[Option('c', "closeWindow", Required = true, HelpText = "Close the ...
49
votes
3
answers
15k
views
How Can I "Update-Package" to a Previous Version in the Package Manager Console?
I have a version of a package installed in my project but during testing I have found a problem with it. I tried the obvious thing Update-Package -Id Foo.Bar -Version 1.0.0 -Force but the Update-...
47
votes
12
answers
19k
views
The "SlowCheetah.Xdt.TransformXml" task could not be loaded from the assembly
After installing Slow Cheeath (v. 2.5.10.3) to two projects in my solution, I am receiving the following error:
"The "SlowCheetah.Xdt.TransformXml" task could not be loaded from the assembly C:\Users
...
47
votes
2
answers
12k
views
How to get the url of a .nupkg file?
I want to download some .nupkg files using my browser
In nuget.org, there are no links to the .nupkg file
46
votes
5
answers
66k
views
Adding reference to another project from visual studio code
If a library (eg, on github) doesn't distribute itself via a nuget package, I'd have to manually include it as a reference, correct? I see a lot of reference posts for how to add a reference to a ...
46
votes
2
answers
9k
views
What is the purpose of Antlr package in Visual Studio 2013 ASP.NET project?
The ASP.NET (web forms) project template in Visual Studio 2013 includes several packages. I'm trying to figure out which ones are essential (may need to create a separate question for this). The post ...
46
votes
4
answers
13k
views
NuGet and multiple solutions
We have two solutions: foo.sln and bar.sln
I have a common library that is used by both foo and bar. Common.csproj is used by both.
If I open foo and update nuget references, all references in ...
43
votes
5
answers
48k
views
How do I use OpenCover and ReportGenerator to view Unit Test Coverage Results?
I'm a noob to using both OpenCover and ReportGenerator and I'm struggling a bit in understanding how to get them working. I'm using VS.NET 2012 'Professional' which means I don't have access to the ...
42
votes
12
answers
94k
views
Unauthorized nuget package from Visual Studio Team Services using asp.net core rc2
I am unable to install/restore nuget packages from a Visual Studio Team Services feed in an asp.net core web application (RC2). I receive the following:
error: Response status code does not ...
41
votes
11
answers
96k
views
Package requires NuGet client version '2.12'
I am trying to install 'WindowsAzure.Storage 8.0.1' in visual studio 2012, but getting the error
package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318....
41
votes
15
answers
141k
views
An error occurred while trying to restore packages. Please try again
I am trying to restore the missing nuget packages and it keeps giving me this Error:
An error occurred while trying to restore packages. Please try again.
Any experience solving this?
How can I find ...