Skip to content
New issue

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

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

Already on GitHub? # to your account

Default Automatically Create Solution in Workspace To FALSE #871

Open
julioct opened this issue Jan 19, 2024 · 2 comments
Open

Default Automatically Create Solution in Workspace To FALSE #871

julioct opened this issue Jan 19, 2024 · 2 comments
Assignees
Labels
area-solution Solution explorer enhancement New feature or request
Milestone

Comments

@julioct
Copy link

julioct commented Jan 19, 2024

Currently, any time you open an existing .NET project in VS Code, with the C# Dev Kit extension installed, a brand new solution file gets created automatically next to the project directory.

This behavior can be turned off using the Extensions > C# Dev Kit Settings > Automatically Create Solution in Workspace setting, but I believe most folks familiar with VS Code would prefer that setting to be off by default.

The reasons why the C# Dev Kit should never generate solutions for .NET projects, and alternatives, are already explained here, here, here and here.

Can the default for Automatically Create Solution in Workspace be changed to false?

Alternatives considered

No response

Environment Information

Extension version: 1.2.7
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.22621
Modes:

@julioct julioct added the enhancement New feature or request label Jan 19, 2024
@microsoft-issue-labeler microsoft-issue-labeler bot added the area-solution Solution explorer label Jan 19, 2024
@arunchndr arunchndr added this to the Backlog milestone Apr 24, 2024
ascott18 added a commit to IntelliTect/Coalesce.Vue.Template that referenced this issue May 28, 2024
@ascott18
Copy link

@arkalyanms I'm assuming you're the AC who replied to my review on the marketplace - this is the issue to which I'm referring. To expand on the OP of this issue and what's already been iterated in the 4 issues linked there:

Sometimes, I open a folder that is not my solution root as a workspace in VS Code. My solutions already have solution files at the top level, but occasionally I will open a specific project's folder as a workspace (e.g. from windows explorer right-click) to do arbitrary stuff in that folder. Usually this stuff has nothing to do with C#.

But then the C# dev kit extension marches in and assumes that the only thing that I would ever want to do in VS Code is work on my C# solution, and it creates a .sln file that I didn't need and don't want. It should not do this. None of the other VS Code extensions I use do anything like this.

We have a lot of projects, and a lot of developers on those projects. Having to instruct every one of our developers to turn this setting off manually in their user settings is really tedious, and we have to keep doing it for every new dev we onboard to prevent these extra .sln files from leaking into our PRs and repos. Disabling this in the workspace settings is also not viable because it would have to be done for every single folder that contains a .csproj that could become a VS Code workspace root when opened.

Please do also reconsider all the feedback in #31 that reiterates just how annoying this behavior is.

@Jxwoon
Copy link

Jxwoon commented Feb 24, 2025

Hello everyone, I wanted to let you know that we have added a new preview feature which should better suit your needs. To enable the preview, you can add the following to your VS Code settings file.

{
    "dotnet.previewSolution-freeWorkspaceMode": true
}

When using the UI, go to Settings and search ‘dotnet solution-free'.

Image

The results should be like what is shown in the previous image. Check the “Dotnet: Preview solution-free Workspace Mode” checkbox. You may need to close, and reopen, the workspace if you have one already loaded.

Note: this setting is also available in the released versions of C# Dev Kit, but we have made significant improvements in the pre-release build. Please use the pre-release build for feedback.

After checking this checkbox, when you open a folder which contains .NET projects, but not solution file, a solution file will not be generated in the workspace. Instead, C# Dev Kit will create a temporary solution file in an external folder. As you make modifications, either using the VS Code UI or the CLI, the solution file will be automatically updated. For example, if you add a project using the dotnet new CLI, the new project will automatically appear in the C# Dev Kit Solution Explorer. When you preform operations that change the projects on disk, for example when switching to a different branch, C# Dev Kit will respond and update the solution file as needed. This is true if you switch branches in the VS Code UI or using the git CLI.

We believe that this support will meet your needs, but we need some feedback before we can enable this by default. If you’ve provided feedback here on the previous experience, please try out this preview and let us know if it’s working for you or not. Without user feedback we cannot enable this by default. Thanks for your patience and feedback.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-solution Solution explorer enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants