vs 2017 intellisense not working C# and XAML

2019-05-06 18:25发布

问题:

I have a Strange issue that I can't seem to fix, my Intellisense for XAML is no longer showing up and the code behind is only showing the premade Members. The Classes and Methods I have made are not showing up. Also Visual Studios is not recognizing other pages and wont recognize Navigation either.

I have tried going to Tools>Text Editor>C#>Intellisense -Statement completion and checking the boxes Auto list members and Parameter information. I also tried to clear out the cache.

From what I have researched it seems nobody else is having the same problems.

回答1:

  1. Close all open tabs in the project and quit VS, reopen the solution in VS and right click the XAML file in the Solution Explorer and then select Open With….> Source Code (Text) Editor.
  2. Delete obj folder and clean project
  3. Right click the XAML page>Properties>Build Action>change it to something else and back
  4. Add a new content page under this specific project and check it works or not.

I would like to add that this worked for my .cs files only.

To get the XAML files Intellisense to work try to repeat the above steps on your .cs files or wait for the XAML files to gain Intellisense.



回答2:

For ReSharper users: I found that having ReSharper's IntelliSense enabled for all languages can break Intellisense unexpectedly (especially for XAML files). Here's how I was able to fix the same problem that the asker had in Visual Studio 2017 with ReSharper installed:

  1. In Visual Studio, go to the ReSharper menu and click on Options.
  2. On the left side go to Environment > IntelliSense > General.
  3. Select the Custom IntelliSense radio button.
  4. Change any languages that have broken IntelliSense to Visual Studio (like XAML).
  5. Click the Save button.


回答3:

Just Exclude and Include Xaml Pages and It works again.



回答4:

I solve that by changing the default editor in visual studio :

  1. In Visual : File > Open
  2. In the open file box : Select a .xaml file (don't open it)
  3. Select "Open with" in the button arrow
  4. Select "Source Code (Text) Editor and Set as Default
  5. Click OK


回答5:

I tried most of the above without much luck, but noticed if I created a new page, then intellisense worked as expected. For the properties section of the xaml file I noticed that the new page had a Custom Tool assigned (MSBuild:UpdateDesignTimeXaml) do I tried to cut-and-paste this into the existing forms without luck.

Looking at the .cs page for the new page that worked I notice that there is some extra info above the partial class [XamlCompilation(XamlCompilationOptions.Compile)] so I added this along with a using Xamarin.Forms.Xaml statement.

Finally I went back to the xaml properties page and selected Reset to Default for the Custom tool. Voila, for me everything started behaving itself.



回答6:

Please add the following Nuget Package from Nuget Console.

Install-Package MobileEssentials.FormsIntellisense -Version 0.1.1-pre

You can download the latest update from the following link.

https://www.nuget.org/packages/MobileEssentials.FormsIntellisense/0.1.1-pre

After installing the package please restart the project and wait for sometime and check it.



回答7:

Just delete .vs directory. this directory is hidden. so