microsoft / microsoft/vscode-dotnettools
[BUG] C# Dev Tools VS Code extension does not detect C# project when workspace is a .code-workspace file
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 321
- Forks
- 54
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 2
Description
Describe the Issue
When opening a plain folder workspace in VS Code, the extension kicks in and sees my C# project. A .sln is generated, IntelliSense works, and I can successfully debug the code.
When I open a .code-workspace file, things no longer work. No solution is created and it is not possible to start a debug session.
Steps To Reproduce
Open a CMD prompt and type:
- mkdir wstest ; cd wstest
- mkdir development ; cd development
- open a text editor and create a
development.code-workspacefile containing:
{
"folders": [
{ "path": "." },
{ "path": "../web-server-cs" },
]
}
- cd ..
- mkdir web-server-cs
- cd web-server-cs
- dotnet new webapi -n MyWebApi
- cd ..\development
- code development.code-workspace
VS Code will be launched. Click the Program.cs file to force the C# extension to be installed. Reload VS Code.
Result: the ASP.NET project will not be seen by the extension. No Solution will show up in the status bar. The SOLUTION EXPLORER pane does show up on the left side, but no solution appears inside, just the Open Solution blue button.
Testing further, following these steps:
- Close VS Code
- cd ..\web-server-cs
- dotnet new sln
- dotnet sln add .\MyWebApi\
- cd ....\development
- code development.code-workspace
This time, the SOLUTION EXPLORER pane does see the project, and things work fine.
Expected Behavior
I expect that the C# project should be detected, IntelliSense should work and launching a debugging session should be possible, even if no solution file is manually created. I tried adding the preview "solution-less" option in the settings.json, but it didn't work.
Environment Information
- Windows 11 24H2
- .NET 9.0 installed through Visual Studio Community 2022, with Desktop .NET components selected. All latest versions installed using Visual Studio Installer.
dotnet --list-sdksshows I have SDK version 9.0.300 installed, and no previous version installed. - VS Code 1.100.1
- C# Dev Kit 1.19.63
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using development.code-workspace and the folder/project layout in the steps, then compare project discovery with a plain folder workspace. The issue names no implementation files or tests, so trace the extension's project-discovery path first; done means the project is detected without a manually created solution and IntelliSense and debugging work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100