82679

ASP.NET MVC Razor Errors After Fresh Installation of Visual Studio 2013 on Windows 8.1

Question:

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.

Recommend

  • Aspect advising other aspects
  • Can't get LogCat (Alcatel OneTouch Evolve)
  • Defining variable by logical subseting on time interval in data.table
  • Partial specialization of a class template in derived class affects base class
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • How to make R's read_csv2() recognise the text characters properly
  • How to revert to previous XCode version?
  • PHP buffered output depending on server setting?
  • Functions in global context
  • Meteor: Do Something On Email Verification Confirmation
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Deselecting radio buttons while keeping the View Model in synch
  • Nant, Vault & Windows Integrated Authentication
  • How to get a value (ex: baseURL) in every Karate feature?
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Is possible to count alias result on mysql
  • Check if a string to interpolate provides expected placeholders
  • Deserializing XML into class C#
  • Where to put my custom functions in Wordpress?
  • How to get next/previous record number?
  • RestKit - RKRequestDelegate does not exist
  • Invalid access key error using credentials redeemed from an amazon open id token
  • Confusion with PayPal's monthly billing cycle
  • Circular dependency while pushing http interceptor
  • Is there a mandatory requirement to switch app.yaml?
  • Comma separated Values
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • How to include full .NET prerequisite for Wix Burn installer
  • WPF Applying a trigger on binding failure
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • Understanding cpu registers
  • how does django model after text[] in postgresql [duplicate]
  • Add sale price programmatically to product variations
  • costura.fody for a dll that references another dll
  • UserPrincipal.Current returns apppool on IIS
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize