ASP.NET MVC Razor errors after fresh installation of Visual Studio 2013 on Windows 8.1
I recently got a new laptop and did a fresh install of Visual Studio 2013 Professional. After installation, the first thing I did was make sure Nuget is set to automatically download the missing packages.
Now I am trying to work on the same great solution I used before getting my new laptop, but I am getting some strange errors that I could not solve after many hours of research.
The most obvious symptom is that I see a lot of errors in Razor views. These are errors like this:
-
The 'lambda expression' function cannot be used because it is not part of the ISO-2 C # language specification
-
The "Anonymous Types" feature cannot be used because it is not part of the ISO-2 C # language specification
-
The function 'implicitly typed local variable' cannot be used because it is not part of the ISO-2 C # language specification
-
The "extension method" function cannot be used because it is not part of the ISO-2 C # language specification
Another symptom: if I try to add a new view, none of the MVC elements are available: for example, there are no .cshtml elements. However, if I create a new solution, these items are available as expected.
I have updated Update Studio 2013 Update 3 along with a fresh install. The solution is using MVC 4 and Razor 2. I checked the web.config and I don't see anything wrong - the Razor and MVC version I want is correct.
Despite these errors, my project is working successfully. Once built, all "implicitly typed local variables" errors disappear within a few minutes and then return. Another person is working on the same solution on an old laptop and is not experiencing these issues.
I hope someone can help. I need to fix this problem because the lack of useful Intellisense is degrading my performance.
source to share
I still have my old laptop, so I compared the settings and file structure on my old machine. The file structure was completely different. I have not used the same root directory on the new computer. I copied files over from my old machine and got TFS bind errors when I opened the old version of the solution. I did some research to figure out how to fix the bindings that led me to manage workspaces. I deleted the existing workspace and added a new one with correct solution paths on my laptop. The original control unit began desperately copying files. When this was finished, I had many conflicts that said, "A versioned file or a writable file with the same name already exists ..." I decided to overwrite the local file for each.then closed Visual Studio and reloaded the project. The problem has been solved.
I believe the root cause of my problem was an invalid workspace. Perhaps I could avoid copying files from my old machine if I fixed the workspace first.
source to share
The reason you are getting this error is because your compiler is more than likely installed on a specific version of the C # language. Some of these features are included in later versions. Try the following:
- Open the Properties project
- Click the Build tab.
- Click on "Advanced"
- Change the Language Version property to default .
By default, it will accept all valid syntaxes, ensuring that all are used .
Here's a good article to make sure Intellisense is enabled and configured correctly, as Visual Studio has a shortcut that can disable it if you're careful.
I believe this is what you are looking for, if you don’t tell me in more detail and I will try to help.
source to share