vs 2017 intellisense not working C# and XAML

ⅰ亾dé卋堺 提交于 2019-12-05 06:38:00
CalebR
  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.

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.

Just Exclude and Include Xaml Pages and It works again.

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

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.

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.

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

Just Exclude and Include Xaml Pages worked for me too. The difference in .csproj file was: MSBuild:Compile now: XamlIntelliSenseFileGenerator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!