0

I'm using Microsoft Visual Studio 2013 professional on a windows 10 laptop and I am seeing an error in all my razor views. The error says the name 'X' does not exist in the current context e.g. The name 'Html' does not exist in the current context.

From searching the internet for solutions I have tried the following but still not fixed

  • Run visual studio repair form control panel (uninstall programs)
  • Run Windows update
  • Checked that the references are set to copy local
  • Deleted my .suo file, cleaned and rebuilt
  • Tried fully qualified namespaces
  • Razor versions are 3.0 in both config and view config
  • Unload Reload the project
  • Reset all my settings using import and export settings wizard
  • Cleaned all packages and cleared package cache

The error looks like so

enter image description here

Can anyone suggest anything else apart from uninstalling and then reinstalling? Despite these errors in my views the application will still build and run in the browser with no ysod.

SIMILAR ISSUE "The name 'HTML' does not exist in the current context" in MVC 3 Views

EDIT - Using info from stackoverflow.com/questions/20422007/… if i go to project properties and make a space in assembly name and save and rebuild then it works!! However as soon as i close VS down and start it up again the issue persists

Thanks Paul

Community
  • 1
  • 1
Paul
  • 620
  • 11
  • 35
  • Hi Paul, when you create a new project and this issue persists? You can try to open 'Developer command prompt for VS 2013' as administrator and run the command: devenv /resetuserdata or devenv /setup to test it. Does this solution works fine before? – Sara Liu - MSFT Jun 19 '17 at 08:02
  • Hi Sara, i can give this a try but interestingly i have activated my resharper ultimate edition and this have 'fixed' the issue. When i say fixed I no longer experience reference issues in my razor files. I suspect that as soon as i disable resharper the issue will persist so ill do that and try your advice. thanks – Paul Jun 20 '17 at 13:50

1 Answers1

0

How sure are you that this is a visual studio issue, and not related to the project? Does it work in other versions of Visual Studio? Do you have the .Net framework installed? (Ensure your project is pointing to the correct .net framework version that you have installed, which you can check in the project properties).

Is the assembly reference in question that's missing, present in the bin folder of your solution?

James Wilkinson
  • 185
  • 2
  • 12
  • Hi James, thanks for taking the time out to provide a response. Im not sure that this is a VS issue but what i can say is that its an issue for every project i open. The funny thing is i was experiencing the issue last night and it seemed to work but its not working again today. all references and dll's are good from what i can see. – Paul Jun 17 '17 at 18:34
  • Using info from https://stackoverflow.com/questions/20422007/visual-studio-2013-c-sharp-web-project-builds-but-ide-reports-the-type-or-namesp if i go to project properties and make a space in assembly name and save and rebuild then it works!! – Paul Jun 18 '17 at 10:18