Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No any IntelliSense while editing csproj file of .net core project. #2787

Closed
ghost opened this issue Dec 8, 2017 · 30 comments
Closed

No any IntelliSense while editing csproj file of .net core project. #2787

ghost opened this issue Dec 8, 2017 · 30 comments
Labels

Comments

@ghost
Copy link

ghost commented Dec 8, 2017

Steps to reproduce

  • Create a new .net core/standard project.
  • Right-click project, select "Edit *.csproj".
  • No any IntelliSense while editing csproj file.
    image

Environment data

VS Build: d15.6stg.27207.3002
dotnet --info:
image

@kkm000
Copy link
Contributor

kkm000 commented Dec 9, 2017

I always add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the main document Project node, try this as a workaround. Makes /pp: output much cleaner too!

@ghost
Copy link
Author

ghost commented Feb 2, 2018

Validate this on d15.6/27401.00 (15.6 Preview 4):
For C# and VB .Net Core project, the IntelliSense can work well.
But for F# .Net Core project, the IntelliSense can't work well.
image

@kkm000
Copy link
Contributor

kkm000 commented Feb 5, 2018

@Xiu-Li, again, simply add xmlns="http://schemas.microsoft.com/developer/msbuild/2003 attribute, like <Project Sdk="..." xmlns="http://schemas.microsoft.com/developer/msbuild/2003">. This does not affect the build, but makes the XML editor pick up the schema, and enables Intellisense.

In any case, the magic of referring the namespace happens in some VS extension, I doubt the MsBuild repository is the correct place to report the problem. Sorry, I cannot suggest where is the right repository for that. What happens for C# projects is the XML editor extension in Visual Studio is hooked up by some other VSIX extension, which supplies the namespace when sees a namespace-less document with the .csproj extension. Try asking the roslyn team.

@ghost
Copy link
Author

ghost commented Feb 5, 2018

@kkm000, thanks very much, after adding xmlns="http://schemas.microsoft.com/developer/msbuild/2003 attribute, enables Intellisense successfully.

@fredrikhr
Copy link

I have this issue to. But adding xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the project node does NOT resolve the issue for me!

@simplexidev
Copy link

simplexidev commented Aug 19, 2018

I had the same issue. Adding the schema worked for me after restarting Visual Studio (v15.8.1).

@fredrikhr
Copy link

I just rechecked, unlike @tom-corwin I really do not get any IntelliSense for my csproj file. Adding the schema does not work, and after restarting Visual Studio it still does not work. After completely reinstalling Visual Studio it still does not work.

What is VERY strange however, is that IntelliSense in the Directory.Build.props works flawlessly!

@simplexidev
Copy link

simplexidev commented Aug 19, 2018

@couven92 I'm not sure if it will help. But in the XML>Schemas... menu, have you tried removing and readding the local copy of the schema?

@fredrikhr
Copy link

@tom-corwin nope, does not help, still no IntelliSense.

@enricoreich
Copy link

enricoreich commented Aug 28, 2018

I have the same problem with .Net Core Projects. IntelliSense for .csproj files does not work if the project is loaded.
BUT IntelliSense works if you unload the project and then edit the .csproj file.

(VS2017 Enterprise 15.8.3)

dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.401
 Commit:    91b1c13032

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.401\

Host (useful for support):
  Version: 2.1.3
  Commit:  124038c13e

.NET Core SDKs installed:
  2.1.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

@YunWeiaa
Copy link

YunWeiaa commented Aug 30, 2018

Yes, not repro for F# .Net Core project on VS2017 Enterprise 15.8.3.

@gorangrubic
Copy link

gorangrubic commented Sep 13, 2018

+EnrichoReich
The problem persists (multitarget, .NET Standard 2.0), even after:

  • adding the schema
  • unloading the project and opening .csproj
    VS Community 2017 15.7.4

@enricoreich
Copy link

enricoreich commented Sep 19, 2018

@gorangrubic
Sorry for my late answer. Yes, I also noticed. After unloading the project you have to close and reopen the solution. Now, if you open the csproj file from the unloaded project Intellisense should work. But if you reload the project Intellisense stop working again.

I have reinstalled VS (15.8.4) with no extensions and created a new dotnet core (ASP.NET core) project but that did not help, Intellisense in csproj file does not work.

After creading a new project the schema parameter in csproj file properties is empty!
Even if I do add the Microsoft.Build.xsd Schema manually or add xmlns attribute suggested by kkm000 Intellisense does not recognize it.

It is frustrating!

@enricoreich
Copy link

enricoreich commented Sep 20, 2018

Hey,

I did some investigations and found out, if you put your project into a solution folder like

brokenintellisense

Intellisense for csproj files does not work properly after reloading the solution. This also happens with .Net-Framework projects. I think it is a VS XML-Editor Problem but I'm not sure.
If yxou move the project out of the solution folder and reload the solution Intellisense for csproj file works without problems.

So, this is sad because I like to organize my projects into solution folders. 😞

@kkm000
Copy link
Contributor

kkm000 commented Oct 2, 2018

@enricoreich: Looks like it, thanks for nailing it down! Unloading a project before editing (i. e. not the shadow-editing with the project still loaded) does not pick up the IS schema either, even though all the right schemata are checked as "use" in the file properties window. But if you copy the file, give it an extension ".xml" and open, then IS works. As if the schema is forced into the XML editor by some Roslyn VS integration component, when the VS is aware (let's say, way too aware in this case) that the file is actually a project file, not just any run-off-the-mill XML document.

If only we find the right team to deal with the issue. I am sure this is not a problem with MSBuild! Let me try to find the folk on GitHub who likely own that part.

@tb-mtg
Copy link

tb-mtg commented Oct 8, 2018

Problem still happening for me too at version VS Community 2017 15.8.6 - even when project is unloaded and with xmlns attribute added to .

@simplexidev
Copy link

@kkm000, I know there's a repo for ASP.NET Core tooling for VS, but I don't know if there is one just for .NET Core. If there is, that's probably the best place for this issue (i'd assume, anyways)

@enricoreich
Copy link

enricoreich commented Oct 9, 2018

I described this problem a few weeks ago at the Visual Studio Developer Community website but apparently there is hardly anyone interested in it. Maybe if it gets some upvotes or comments someone will take care of it.

https://developercommunity.visualstudio.com/content/problem/340537/intellisense-for-csproj-file-not-working-if-projec.html

@simplexidev
Copy link

@enricoreich I gave it an upvote, hopefully they'll fix it sooner rather than later.

@tb-mtg
Copy link

tb-mtg commented Oct 10, 2018

@tom-corwin @enricoreich I also gave it an upvote.

@simplexidev
Copy link

@enricoreich I found the project I was looking for dotnet/project-system

Here's an issue tracking IntelliSense not working in C# projects: dotnet/project-system#3225

@davkean
Copy link
Member

davkean commented Oct 31, 2018

Here's another two hits of this:

dotnet/project-system#3225
dotnet/project-system#4061 (comment)

@YunWeiaa
Copy link

Not repro on VS-Val/d15.9/28230.54 (15.9 preview 5.0). For C#/VB/F# .Net Core project, the IntelliSense can work well.

@huoyaoyuan
Copy link
Member

huoyaoyuan commented Nov 1, 2018

For my cases:
OS: Win10 Pro 17763, Simplified Chinese
VS: 15.8.8, Simplified Chinese/English

When switching VS to English, IntelliSense works with a simple playground project. When switching to Chinese it does not work.
But it does not work with my customized projects, even in English.
Further information: these projects use Directory.Build.props to import target framework, and VS cannot load them if explicitly set project GUID in solution file.

VS 15.8.8 gives my project files(on which IntelliSense not works) indent=4, while some older version gives 2.

Edit: the cause for my projects should be Solution Directories. When I move a project into root level of solution, it just suddenly works(without reloading).

@enricoreich
Copy link

I can repro this in VS-Enterprise 15.8.9 & 15.9preview5.

OS: Windows 10 Pro [17763.55, 1809], Language: German
VS: 15.8.9 & 15.9preview5 (without additional extensions), Language: English (both)

If I create a project at solution root (in VS) Intellisense for csproj files works as intended. But if I create or drag&drop a project into a solution folder/directory and reload the solution, it does not work e.g. almost no Intellisense for csproj files. Only code completions for CDATA and comments are shown.

@fredrikhr
Copy link

Same here as @enricoreich describes. I actually use a Directory.props file to enforce the following .NET repository structure:

root
├─ bin
|  ├─ Debug
|  |  ├─ netstandard1.3
|  |  └─ netstandard2.0
|  └─ Release
|     ├─ netstandard1.3
|     └─ netstandard2.0
├─ obj
|  └─ ...
├─ src
|  └─ ...
├─ sample
|  └─ ...
├─ test
|  └─ ...*.Test
├─ .gitignore
├─ .gitattributes
├─ .editorconfig
├─ LICENSE
├─ README.md
├─ AllRules.ruleset
├─ Directory.Build.props
└─ *.sln

I use dotnet sln add to add projects to the solution which will organise the projects in solution folders that match the actual on-disk file system hierarchy.

@robertmclaws
Copy link

Just an FYI, even though I get limited Intellisense in the latest VS 15.9 builds, it still doesn't have any information on None/Content attributes like Pack and PackagePath.

@ScotBren
Copy link

I don't yet know the underlying cause of the problem, but let me share the experience I just had with a customer reporting the same problem in the VS 2019 Enterprise 16.4.5 XML editor, trying to edit a .csproj. Setting the xmlns made no difference to him.
However, when I observed that his system was set to locale 1036 (French - France) and mine is 1033 (English - US), just as an experiment, I zipped up all of my xml\schemas folder and subfolders and shared them with him. He dropped that into his machine, and the IntelliSense is working for him. We haven't yet taken the time to investigate the differences, but it's important to note that this problem may be related to language/locale-specific differences.

@rainersigwald
Copy link
Member

It looks like there may be multiple issues reported here. I think the main one was fixed as #2723 for Visual Studio 16.5. I'm going to close this issue, but please don't hesitate to file a new issue if you see problems on 16.5 or higher. Please include details like your OS and Visual Studio versions, language settings, and what you expect to see and actually experience.

@Legends
Copy link

Legends commented Jul 4, 2020

VS 2019: I get no intellisense for the import element but not for the attributes. The import is located directly under Projects

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests