I recently got a new laptop and did a fresh installation of Visual Studio 2013 Professional. After installation, the first thing I did was to make sure that Nuget was set to automatically download missing packages.
I'm now trying to work on the same large solution I was using before getting my new laptop, but I'm getting some strange errors that I haven't been able to resolve after many hours of research.
The most obvious symptom of the issue is that I see many errors on Razor views. They are these types of errors:<ul><li>
Feature 'lambda expression' cannot be used because it is not part of the ISO-2 C# language specification</li> <li>
Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification</li> <li>
Feature 'implicitly typed local variable' cannot be used because it is not part of the ISO-2 C# language specification</li> <li>
Feature 'extension method' cannot be used because it is not part of the ISO-2 C# language specification</li> </ul>
Another symptom is that if I try to add a new view, none of the MVC items are available: for example, no .cshtml items. However, if I create a new solution, these items are available as expected.
I updated to Visual Studio 2013 Update 3 along with the fresh installation. The solution uses MVC 4 and Razor 2. I've checked the web.config and see nothing wrong - the version of Razor and MVC I want are correct.
Despite these errors, my project builds successfully. After the build, all of the 'implicitly typed local variable' errors disappear for a few minutes, then return. Another person is working on the same solution on an old laptop and is not experiencing these issues.
I'm hoping somebody can help. I need to resolve this issue because the lack of useful Intellisense is hurting my productivity.Answer1:
I still have my old laptop, so I compared the settings and file structure on my old machine. The file structure was very different. I was not using the same root directory on the new machine. I copied the files from my old machine and got TFS binding errors when I opened the old version of the solution. I did some research to figure out how to fix the bindings, which led me to managing the workspaces. I removed the existing workspace and added a new one with the correct paths to the solutions on my laptop. A source control box started frantically copying files. When it was finished, I had a lot of conflicts that said "A non version controlled file or or writable file by the same name already exists..." I chose to overwrite the local file for each one, then closed Visual Studio and reloaded the project. Problem solved.
I believe that the root cause of my issue was the invalid workspace. I probably could have avoided copying files from my old machine if I had fixed the workspace first.Answer2:
The reason your receiving that error is because your compiler is more than likely set to a specific version of the C# language. Several of those features are included in later versions. Try the following:<ol><li>Open the project's <em>Properties</em></li> <li>Click the <em>Build</em> tab.</li> <li>Click <em>Advanced</em></li> <li>Modify the <em>Language Version</em> property to <strong>default</strong>.</li> </ol>
<strong>Default</strong> will accept <em>all valid</em> syntax, which would ensure your utilizing <strong>all</strong>.
Here is a nice <a href="http://msdn.microsoft.com/en-us/library/vstudio/ecfczya1%28v=vs.100%29.aspx" rel="nofollow">article</a> to ensure Intellisense is enabled and configured correctly, as Visual Studio does have a shortcut that can disable it if you aren't careful.
I believe that is what your looking for, if not let me know with some more details and I'll attempt to help.