Webcognoscere
Webcognoscere

Reputation: 1822

Visual Studio 2012 IDE Complaining about namespaces after upgrade

I've recently upgraded my VS 2010 Solution to a VS 2012 solution. It is a solution with various class libraries and an MVC web application. I've upgraded all projects to .NET 4.5 but have this strange error.

The solution builds 100%, but whenever I'm in a controller (any controller), any references to classes within my MVC project are unrecognized, i.e. I get the 'The type of namespace name 'xxx' could not be found etc.' and I have no intellisense on any of my own classes etc. but the project builds and works perfectly.

Any ideas??? And yes, it's very sporadic, it will work from one minute and won't the next.

Upvotes: 4

Views: 2465

Answers (6)

dev30207
dev30207

Reputation: 527

I just recently ran into this situation after converting a app built in an older version of VS. My fix was to change the main app's targeted .Net version from 3.5 to 4.5 to match the targeted framework of my references.

Upvotes: 0

James Lawruk
James Lawruk

Reputation: 31353

Run Build -> Clean Solution.

Or..

Right-click on the project that Visual Studio cannot find the reference for and select Clean.

Upvotes: 3

Jesse MacNett
Jesse MacNett

Reputation: 459

I have the same issue almost daily; I haven't found a permanent fix as yet, but I did find that running the following from a command line will fix it ~60% of the time (provided you're willing to close out the IDE first):

del /F /Q %LocalAppData%\Microsoft\WebsiteCache

I ended up putting that in a .cmd file on my desktop, which I run as needed. Not pretty, but faster than the other solution I found (completely purge the solution/project directories and pull a fresh copy out of TFS).

Upvotes: 1

Andrew Monks
Andrew Monks

Reputation: 666

Just fixed this on one of my solutions.

Open your project file in notepad. If you look at the references they have with relative locations. Replace all with the absolute file locations.

eg. ..\packages should be c:\myproject\packages

Re-open in Visual Studio and all should be good.

Upvotes: 1

emalamisura
emalamisura

Reputation: 2904

I had this same issue, I tried a full uninstall reinstall, I tried a full uninstall and removing any remnants I could find by hand and reinstall. I tried a repair through setup, still nothing.

I tried creating a new users in the OS and loading it through that, still same issue. I tried starting visual studio by using the devenv.exe /resetsettings, I also tried devenv.exe /safe but still nothing.

Still same issue, I ended up doing a complete wipe of my OS to get this fixed. By no means a fix of any kind but I literally tried everything I could. Definitely something wrong were setup.exe does not install correctly under certain circumstances causing this...

I want to add though, that for me this was not project type specific. Although at first I thought it was since I was using mostly MVC Project types, but I created a couple other project types and it still had the problem...

Upvotes: 2

Max
Max

Reputation: 2571

I guess you have resharper installed?

Try: Tools->Import and export settings->Reset all settings

Upvotes: 2

Related Questions