Sean Holmesby
Sean Holmesby

Reputation: 2145

Visual Studio 2012 can't resolve namespace even though DLL reference seems fine

I have attempted to create an MVC 5 project by creating an MVC 4 project in Visual Studio 2012 and installing MVC 5 through Nuget. I can build this fine.

I attempt to add a reference to another DLL, Sitecore.Mvc.DLL, which I can see was built against MVC 5.1.0. The DLL reference is added fine, and there seems to be no .NET framework conflict (which is where I've seen this issue in the past).

I'm trying to add a using statement to my code:-

using Sitecore.Mvc.Presentation;

IntelliSense picks this up fine....even allowing me to auto-complete 'Presentation'.

However when I build I get the following error:-

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

What could be the issue here?

I'm using:-

Upvotes: 1

Views: 2011

Answers (1)

Sean Holmesby
Sean Holmesby

Reputation: 2145

Turns out I'm using a different version of Sitecore.Mvc.DLL, which IS targeted to .NET 4.5.1. Seems like the mscorelib reference in Reflector doesn't quite tell all the details.

Now I need to target my Web App to .NET 4.5.1, which means I need to follow the steps here to be able to select it.

http://blogs.msdn.com/b/dotnet/archive/2013/08/08/building-apps-with-the-net-framework-4-5-1-preview-in-visual-studio-2012.aspx

Thanks, and sorry to @Khanh TO, and everyone else for helping out.

Upvotes: 1

Related Questions