Open dileep-hegde opened 11 months ago
This is intentional. The extension is only loaded when there is any .csproj in the workspace, or any .cs file is opened. It is not activated by a single .sln file. Generally, some developers may open a C++ workspace, and do not expect the C# extension to be loaded. In your case, you can still use "Open solution" command to open the blank solution. It will require one more step, but save time for others who do not need it.
Hi @lifengl
That's true. while it is better to have one more step to open a Solution when we don't have a specific project yet. But, when we first open a folder with a blank solution, then create a project and add it to the solution. Solution Explorer is not showing.
The Solution Explorer is showing only when we have a project before opening the folder.
I think, using "Open solution" command is not the ideal solution for everyone. Moreover, we should know that command exists to use it.
At least, once we add the project to the solution, it should detect the changes and trigger the Solution Explorer.
As the issue is still there. Requesting you to reopen and consider this.
Thank you
Hi @timheuer,
I'm not sure whether I can tag you here. But, as @lifengl has closed this issue abruptly with no further response. As the issue is still there. I just wanted someone to look into the issue.
Solution Explorer is not showing when we open a blank solution. So he suggested to use "Open solution" command to open it and told this is intended as c# extension should not be loaded for other developers.
But, the issue is when we first open a folder with a blank solution, then create a c# project and add it to the solution. Yet, Solution Explorer doesn't show up.
[My thoughts] At least, once we add the c# project to the solution, it should detect the changes and trigger the Solution Explorer. Or a pop up should come with an option to open it in Solution Explorer.
Requesting to reopen and consider this issue as per my thoughts mentioned above.
Hi @dileep-hegde -- see below...it does refresh for me.
Steps:
dotnet new sln
(created emptysol2.sln)dotnet new webapi -o webapp
in the directory where the emptysol2.sln wasdotnet sln add .\webapp\webapp.csproj
Hi @timheuer,
Thanks for the quick response.
It only works after using "Open Solution" command atleast once.
But, my concern is that without using the command, if we create a c# project after opening a blank solution doesn't trigger Solution Explorer.
As I already mentioned, everytime having an extra step to open a blank solution doesn't look like a ideal solution for everyone and also the developers would be able to use it only when they are aware of this command.
So, I think, the ideal solution would be to automatically trigger the Solution Explorer, once we add the c# project to the solution Or a pop up should come at the bottom with an option like "open it in Solution Explorer".
So, as I mentioned above if it can automatically do that extra step without expecting the user to be PRO would be the better solution
Thank you for taking your time to listen to my thoughts.
Got it, thanks @dileep-hegde -- I think what @lifengl points out is that .sln format is not unique to C# so our concern was opening without a context of also csproj may result in attempting to open an sln that has something like vcxproj that we know would always be unsupported...
Will keep this open to reconsider with the team...might be okay to make that assumption.
yeah, that is a fair scenario to think about, although the .sln file is not essential piece. If we take it out, creating the first .csproj inside a blank workspace would also be a valid scenario. Unless the user is deeply influenced by Visual Studio, creating a solution file provides very little value, until there are at least two projects. Users who work mostly with CLI commands may start with creating a .csproj.
Basically, to reduce overhead of the extension to users who don't need it, the condition to load the C# Dev Kit (there is any .csproj file or user edits a .cs file) is checked by VS Code. Before that, the extension will not be loaded, so it would not be able to add any file watcher. If vs code triggers it to load when a .csproj is created, it would be reasonable to ask the extension to handle it. Otherwise, I think it would be reasonable that the extension is triggered only after user opens a C# code file in VS code, after creating the project. That is when the developer would benefit from the language service, and maybe other features from the solution explorer. I feel this is a part of the nature flow of using VS Code after creating the project with CLI command, and a pop-up before that point is not necessary (and many developers hate pop-ups in the middle of their workflow).
Working
⚡[!NOTE]
- Opening .cs file triggers C# dev kit, then opens solution explorer.
- Moreover, if we don't create a .sln file before opening .cs file, it automatically creates a .sln file and add the project as well.
But, not as expected, it creates .sln file inside the project folder
BUG
🐞[!IMPORTANT]
- As, C# dev kit is getting triggered when we just open a folder with a blank solution in VS Code, I think, both VS Code and C# dev kit is not detecting any further changes.
- But why in this scenario, C# dev kit doesn't check changes in real time.
BUG
🐞Case 1: Unknown Behavior
[!WARNING]
- Using the folder where previously only C# dev kit detected is tricky.
- This behavior might be because we are trying to create a .sln file even before VS Code triggers extensions.
Case 2: Unexpected Behavior
[!IMPORTANT]
- Also, if we open an empty folder in VS Code and like in case 1, if we create a .sln file before it triggers extension. It will work the same this time. Because previously both C# dev kit and solution explorer were triggered in this folder.
- So, I think, it is something to do with using existing folder and/or same VS Code session or triggering extensions.
I think, it looks good, if everything works the same irrespective of the approach.
Thank you
Describe the Issue
When we create a new solution file using the dotnet CLI and try to open that in VS Code, Solution Explorer is not showing.
A blank solution gives more control and flexibility over project configuration and structure.
Steps To Reproduce
dotnet new sln
.Expected Behavior
Opening a blank Solution should add Solution Explorer tab.
Also, if we can have an option to create a solution with 'Blank Solution' Template will be helpful.
Environment Information