4

Well, there´s the (not so new) package system for ASP.NET MVC 5 and theres a lot of new methods and namespaces. But sometimes I get stucked to know where to find some namespaces.

For example:

I need to use the System.Web.Mvc namespace so i search it on the NuGet ( in vs2015) and I dont get any microsoft official package to download in the list. So i go to the msdn documentation and find this link. And again, nothing about the package.

What im missing here? How to find the correct packages to download?

gog
  • 11,788
  • 23
  • 67
  • 129
  • MVC 5 has not changed. There is a new [MVC 6](https://github.com/aspnet/Mvc) that is a part of ASP.NET Core 1.0 (which was previously known as ASP.NET 5). – mason Feb 16 '16 at 19:01
  • i Know, but the question isnt about it – gog Feb 16 '16 at 19:04
  • MVC 5 has not changed. The NuGet package for it is called Microsoft.AspNet.Mvc and it's still available [here](https://www.nuget.org/packages/microsoft.aspnet.mvc/). I think your mistake is in assuming that NuGet package names correspond with the namespaces in the code, which isn't necessarily the case. – mason Feb 16 '16 at 19:07
  • @mason yes, i agree with you but, is it not strange? I cannot find information about which package i need for some speciefic namespace. – gog Feb 16 '16 at 19:08
  • NuGet is just a package container, think of it as a zip file with a *little* bit of metadata. Unless the package maintainer has added a list of included namespaces to the package description, you're not going to be able to find them. You'll have to know ahead of time which NuGet package contains the namespaces you seek. – mason Feb 16 '16 at 19:09

2 Answers2

4

As you've already seen, searching NuGet for the namespace won't return the package you need in many cases.

Unfortunately I don't think there is any easy way to reference a namespace back to an existing package. You are going to have to research what you need for each case. In most cases you can search the internet to find the answer.

I believe you can install System.Web.Mvc from:

Install-Package Microsoft.AspNet.Mvc -Version 5.2.3

Or whatever version you need...

Andy B
  • 101
  • 1
  • 8
-2

System.Web.Mvc is available in ASP.NET MVC 5 framework. If you create a MVC project in Visual Studio, this namespace is automatically included in the project. If you need to reference it in a non web project (highly un-recommended), you can do so by adding a reference from under the project.

enter image description here

mojorisinify
  • 377
  • 5
  • 22
  • 1
    NuGet is *not* just for 3rd party libraries or packages. It's also for assemblies developed by Microsoft, including some that used to be part of the .NET framework. – mason Feb 16 '16 at 19:11