ReSharper 7.1 is not recognizing Razor in MVC 4 VS2012

Hi,

I have MVC4 project which I created with VS2010 and ReSharper 6. All Razor files were successfully parsed/recognized by ReSharper and I had full intellisense inside them, i.e. properties of the "Model" object, navigation to actions in controllers, etc.
However after updating to VS2012 with ReSharper 7.1 all Razor bits are highlighted in red and if I hover them I get "Cannot resolve symbol 'Model'" (or 'Html' for @Html, etc).
What would cause this?

Thanks.
Andre.

9 comments
Comment actions Permalink

Hi Andre,

Is it the same project working in VS2010 and non-working (in terms of resolving symbols) in VS2012?
Have you tried to clear the caches in ReSharper | Options | Environment | General dialog?

Thanks.

0
Comment actions Permalink

Hi Alex,

Unfortunately I have upgraded my VM to Windows 8 and had a clean install of OS & VS2012, so I don't have VS2010 anymore to confirm if it is still working fine there or not.
I have cleared Resharper caches the way you suggested, but problem is still there, Resharper shows "Cannot resolve symbol 'Model'" type of errors in my cshtml files. Other types of files are unaffected.
Have you got any other suggestions I can try?

Cheers,
Andre.

0
Comment actions Permalink

Hello Andre,

Thanks for the info.
There's some more things to check:
1) Could you please specify the exact ReSharper version you use (ReSharper | Help | About JetBrains ReSharper)?
2) Could you please check if it affects all MVC4 solutions - please try to create new solution and check if symbols are resolved there fine.

Please let me know the results.
Thank you.

0
Comment actions Permalink

Hi Alex,

Here is the exact version of the ReSharper:

JetBrains ReSharper 7.1.1 Full Edition

Build 7.1.1000.900 on 2012-12-13T05:22:48



Visual Studio 11.0.50727.1.

I have created new MVC4 project and intellisense is working as expected in that project. So this indicates that something is not right in my project/solution...
Problem is that my project is deep customization of nopCommerce shopping cart, so re-creation is not an option for me :(
Have you had any other issues with nopCommerce customers? Is there something I can check?

Cheers,
Andre.

0
Comment actions Permalink

I have found the problem. I upgraded my nopCommerce from 2.65 to 2.80. One of the changes is that they moved from MVC3 to MVC4. During upgrade (manual merge) I accidently left a couple of older packages including MS MVC packages in my solution. Visual Studio successfully ignored them, but Resharper picked them up..
After doing a comparison with vanilla nopCommerce 2.80 I have discovered and removed them. As result all problems with Resharper has disappeared.
Hopefully this might help someone with the similar issues.

Andre.

0
Comment actions Permalink

Hello Andre,

Thanks for the information!
We were thinking about some migration issues here since you told us about upgrading from VS2010 to VS2012, but haven't thought about MVC3 to MVC4 yet. Thanks again for the description and it's great that it's now working fine for you!

0
Comment actions Permalink

I am having the same issue.  Our upgrade to MVC4 was done a while ago before upgrading to VS2013.  It works find in VS2012, but not in VS2013.

Microsoft Visual Studio Ultimate 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0449004-02492
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0449004-02492
Microsoft LightSwitch for Visual Studio 2013

Microsoft Office Developer Tools for Visual Studio 2013 ENU   06181-004-0449004-02492
Microsoft Office Developer Tools for Visual Studio 2013 ENU

Team Explorer for Visual Studio 2013   06181-004-0449004-02492
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0449004-02492
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0449004-02492
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0449004-02492
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0449004-02492
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02492
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

AnkhSVN - Subversion Support for Visual Studio   2.5.12266.473
AnkhSVN - Subversion Support for Visual Studio 2.5.12266.473
* Ankh.Package 2.5.12266.473
* Subversion 1.8.4 via SharpSvn 1.8004.2605.15365

SharpSvn is linked to: Apr 1.4.8, Apr-util 1.5.2, Cyrus Sasl 2.1.23, OpenSSL 1.0.1e 11 Feb 2013, serf 1.3.2, SQLite 3.7.17, Subversion 1.8.4-SharpSvn-1.8.4, ZLib 1.2.8
SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 1.8004.2605.15365

ASP.NET and Web Tools   2013.1.41009
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.0.11001.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.0
Provides common services for use by Azure Mobile Services and Windows Azure Tools.

JetBrains ReSharper 8.1   Full Edition build 8.1.23.546 on 2013-12-12T09:30:52
JetBrains ReSharper 8.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.

NuGet Package Manager   2.7.40911.287
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

TechTalk SpecFlow   1.9.3
TechTalk SpecFlow - Binding business requirements to .NET code, http://www.specflow.org
Copyright © 2009–2013 TechTalk

Windows Azure Mobile Services Tools   1.0
Windows Azure Mobile Services Tools

Windows Azure Remote Debugging   1.0
Windows Azure Remote Debugging Community Technology Preview

Windows Azure Tools   2.2
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.2.11003.1601

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

0
Comment actions Permalink

I'm having this same issue, Resarper won't recognize @Html helpers in any Razor View.  I recently upgraded from MVC4 to MVC5, I also cleared my Resarper Caches.

<package id="Microsoft.AspNet.Mvc" version="5.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.1.0" targetFramework="net45" />

Using: Microsoft Visual Studio Ultimate 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Ultimate
Architecture and Modeling Tools   06181-004-0449004-02939
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.
LightSwitch for Visual Studio 2013   06181-004-0449004-02939
Microsoft LightSwitch for Visual Studio 2013
Microsoft Office Developer Tools for Visual Studio 2013 ENU   06181-004-0449004-02939
Microsoft Office Developer Tools for Visual Studio 2013 ENU
Team Explorer for Visual Studio 2013   06181-004-0449004-02939
Microsoft Team Explorer for Visual Studio 2013
Visual Basic 2013   06181-004-0449004-02939
Microsoft Visual Basic 2013
Visual C# 2013   06181-004-0449004-02939
Microsoft Visual C# 2013
Visual C++ 2013   06181-004-0449004-02939
Microsoft Visual C++ 2013
Visual F# 2013   06181-004-0449004-02939
Microsoft Visual F# 2013
Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02939
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker
Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.
The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.
Windows Phone SDK 8.0 - ENU   06181-004-0449004-02939
Windows Phone SDK 8.0 - ENU
ASP.NET and Web Tools   2013.1.41009
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure
ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013   5.0.11001.0
For additional information, visit http://www.asp.net/
Common Azure Tools   1.0
Provides common services for use by Azure Mobile Services and Windows Azure Tools.
Entity Framework Power Tools   1.0
Adds useful design-time DbContext features to the Visual Studio Solution Explorer context menu.
When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:
1) View Entity Data Model - Displays the underlying Code First model in the Entity Framework designer.
2) View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
3) Generate Views - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.
JetBrains dotTrace Performance 5.5.3   Professional Edition build 5.5.3.554 on 2013-12-11T10:07:28
JetBrains dotTrace Performance 5.5.3 package for Microsoft Visual Studio. For more information about dotTrace Performance, visit http://www.jetbrains.com/profiler/. Copyright © 2005–2014 JetBrains, Inc.
JetBrains ReSharper 8.1   Full Edition build 8.1.23.546 on 2013-12-12T10:30:52
JetBrains ReSharper 8.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.
Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build
NuGet Package Manager   2.7.40911.287
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools
Telerik Kendo UI for ASP.NET MVC VSExtensions   2013.3.1316.0
Telerik Kendo UI for ASP.NET MVC VSExtensions
Telerik WebUI VSExtensions   2013.3.1031.0
Telerik RadControls for ASP.NET AJAX VSExtensions Package
Windows Azure Mobile Services Tools   1.0
Windows Azure Mobile Services Tools
Windows Azure Remote Debugging   1.0
Windows Azure Remote Debugging Community Technology Preview
Windows Azure Tools   2.2
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.2.11003.1601
Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.



Attachment(s):
RazorView.png
0
Comment actions Permalink

Well, I also fixed this by making sure all of my packages in package.config were the correct version accross all the projects in my solution.

0

Please sign in to leave a comment.