简体   繁体   中英

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;

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.

You should remove all files from

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

folder.

And restart Visual Studio

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM