0

I have a class library project created with Visual Studio 2015. I tried to add the package Microsoft.AspNet.Mvc to my project with NuGet. That worked out fine a you can see from the screenshot.

enter image description here

But whenever I try to use the Microsoft.AspNet.Mvc namespace in my project, it complains that it cannot find the given namespace.

The type or namespace name AspNet does not exist in the namespace 'Microsoft'

But it's clearly referenced in my project... Anyone any idea what the problem is?

3
  • Are you on Visual Studio 2015 RTM? Your references are out of date. Commented Sep 1, 2015 at 1:28
  • @opiants No, I installed the visual studio community edition. Commented Sep 1, 2015 at 7:44
  • Ok but is it the release version or beta? If you go Help > About Microsoft Visual Studio, what version does it say? Commented Sep 1, 2015 at 21:21

2 Answers 2

1

I have just add the code below to my project.json file and rebuild the project and the problem solved,now I have access to using Microsoft.AspNet.Mvc;

 "frameworks": {
"dnx451": { },
"dnxcore50": { }}
Sign up to request clarification or add additional context in comments.

Comments

0

Change your class library to be a project.json (i.e. MyClassLib.xproj) and then reference Microsoft.AspNet.Mvc 6.0.0-*.

I'm not sure a csproj class library project can consume MVC 6.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.