I'm building an ASP.NET MVC app with VS 2017, targeting .NET 4.7, and I'm trying to build my models inside of business library being referenced by the web application. So I'm trying to get many of the same classes that come with an MVC project by default into a brand new class library.

Particularly, I'm getting the following error:

Error

This is very different from the previous times this question was posted:

  1. The type or namespace name 'IClientValidatable' could not be found
  2. The type or namespace name 'IClientValidatable' could not be found (are you missing a using directive or an assembly reference?)

Namely, in that they both are solved simply by including the using statement for System.Web.Mvc where IClientValidatable lives.

But I've definitely already done that... Here's the reference manager for the class library with the reference included available for .NET 4.7

Reference manager

As further proof, here's a side by side example of where I can pull in some classes from System.Web.Mvc, but not IClientValidatable

Side by Side

For reference sake, here's the configuration on the class library itself

Class Library

So did this class move somewhere? Is it available with .NET 4.7?

So the real question seems to be not where did it go, but why the most recent framework is targeting such an old version.

When trying to add a reference to System.Web.MVC while targeting .NET Framework 4.7, the only available option is MVC v2.0.0.0 which is incredibly old. When seeding a new MVC app, it'll come with v5.2.3.0

Here's the Assembly Explorer with both libraries loaded. Common items will be highlighted in each, but IClientValidatable wasn't added until later.

Assembly Explorer

And here's the VS 2017 Reference Manager where you can add references based on your current framework, showing the old MVC library for the new .NET version.

Reference Manager

So the question then becomes....

Q: How can I add a reference that is not available in the list of assemblies for my framework?

A: Same way you'd add any other reference - you can browse to a dll or grab it from nuget.

DLL If you already have a web app, there are good odds you can find the dll in your existing packages directory at something like:

<!-- language: lang-none -->
\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll

If you prefer Nuget, some minor annoyances are that nuget package names don't exactly sync up with the assemblies they install, it's not easy to browse or search which assemblies come with which packages, and they libraries and frameworks often come bundled with other things you might not need. All that said, you'll be looking for the package called:

Microsoft.AspNet.Mvc on Nuget

Microsoft.AspNet.Mvc - Package

Which will install the following libraries:

Microsoft.AspNet.Mvc - Libraries