Generally speaking, how do we determine which NuGet package is going to contain a specific namespace.
Use case
We're changing a project so that NuGet handles most if not all of its referenced assemblies. In step one, we deleted all the references from the *.csproj
file, deleted bin/
, deleted the existing packages/
and packages.config
, and deleted any *.dll
in the project. In step two we built the project and read the error list of missing assembly references. One at a time, we're adding each missing reference using NuGet. E.g.
Install-Package Microsoft.AspNet.Mvc
Install-Package Microsoft.AspNet.Identity.Core
Install-Package EntityFramework
Install-Package Microsoft.AspNet.Identity.EntityFramework
Install-Package Microsoft.Owin
Install-Package Microsoft.AspNet.Web.Optimization
Install-Package Microsoft.AspNet.Identity.Owin
Install-Package Microsoft.Owin.Host.SystemWeb
Sometimes it's tough to determine what NuGet package to install. Other times there isn't a NuGet package and we need to add the reference the "old fashioned way".
- System
- System.Web
- Microsoft.CSharp
Doing the above resolved all of the following errors. It took a while, though, and I'm wondering how to find the appropriate NuGet packages next time.
The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)
The type or namespace name 'UserManager' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'RouteCollection' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'RequiredAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Required' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Owin' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'IUserStore' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IOwinContext' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Display' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'DisplayAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'EmailAddress' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'EmailAddressAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'HttpPost' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'HttpPostAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IAppBuilder' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IDataProtectionProvider' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IdentityDbContext' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IdentityFactoryOptions' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IdentityResult' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'DataTypeAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'DataType' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'ComponentModel' does not exist in the namespace 'System' (are you missing an assembly reference?)
The type or namespace name 'CompareAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?)