Saphire
Saphire

Reputation: 1930

No syntax highlighting

I am coding .cs files in Visual Studio 2013 with an Indie license of Xamarin. In Xamarin Studio the syntax of following code gets properly highlighted

EditText username = FindViewById<EditText> (Resource.Id.Username);
EditText pass = FindViewById<EditText> (Resource.Id.Password);

But in VS it is all in white colors and with no IntelliSense as well.

I could get syntax highlighting working for .axml files, but not for Xamarin .cs files.

Other .cs files, not generated in Xamarin, work fine.

I think this is connected with following using statements

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

Upvotes: 5

Views: 7478

Answers (3)

Denis Kornev
Denis Kornev

Reputation: 119

You should remove all files from

%User%\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

folder.

And restart Visual Studio

Upvotes: 6

SuavePirate
SuavePirate

Reputation: 1513

Okay, I know this thread is old now, but I encountered the exact same issue and after a bit of fighting, got it to work again.

I tried all the different suggestions for similar issues (ie. Resetting Visual Studio settings, deleting local AppData, even re-installing both Visual Studio and Xamarin).

What it came down to in my situation was an error in one of my layout files ( .axml ) my particular issue was that I had left out my unit for a layout_height. Once I fixed it, Cleaned, and did a Build, the highlighting still wasn't working. But with one last restart of Visual Studio I was back up and running.

I was even able to reproduce it a few times to make sure that was a true solution and not some happenstance.

Upvotes: 3

GVashist
GVashist

Reputation: 427

The using directives here include the Android class libraries. Unless the references to these libraries are added to your project, VS does not know what Android.App is, for example.

Add the appropriate references to your project. Once added, the using statements must be correctly recognized and the EditText statement must be highlighted too.

Upvotes: 1

Related Questions