Add "convert to project" menu option#9472
Closed
Copilot wants to merge 28 commits into
Closed
Conversation
Implements microsoft/vscode-dotnettools#2369. Adds a new `dotnet.convertToProject` command that lets users convert a file-based C# app to a project-based app by running `dotnet project convert <file>` in an integrated terminal. Two entry points are provided: - Right-click on a .cs file in the Explorer or editor → "Convert C# File-based App to Project" - Command palette → "Convert C# File-based App to Project" → quick pick of all discoverable file-based app entry points in the workspace (files starting with `#!` or containing `#:` directives) Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Copilot
AI
changed the title
Add "Convert C# File-based App to Project" command (fixes vscode-dotnettools#2369)
Add "Convert C# File-based App to Project" command
Jun 25, 2026
Copilot created this pull request from a session on behalf of
mwiemer-microsoft
June 25, 2026 18:55
View session
…ne, language-ID check
- Export `FileBasedAppKind` enum and `detectFileBasedAppKind` with injectable
reader so unit tests don't need fs mocks
- Export `isInProjectCone` helper (walk ancestor dirs to find .csproj)
- pickAndConvertToProject: include C# files outside any .csproj cone as FBA
entry points even when they lack explicit #! / #: markers
- pickAndConvertToProject: augment the findFiles result with any open text
documents that VS Code already treats as csharp language but lack .cs ext
- convertToProject (right-click path): check document.languageId === 'csharp'
via openTextDocument instead of filePath.endsWith('.cs')
- Add TODO noting that the .NET 10 SDK has no CLI command for FBA detection
(only dotnet project convert); flag the Roslyn LSP request as the future fix
- Add 20 unit tests covering shebang, directives, BOM, None edge cases, and
all isInProjectCone permutations
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Copilot
AI
changed the title
Add "Convert C# File-based App to Project" command
fileBasedApps: unit tests, no-csproj cone detection, language-ID check
Jun 26, 2026
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
This comment was marked as duplicate.
This comment was marked as duplicate.
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
…ocalization bundle Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Co-authored-by: mwiemer-microsoft <80539004+mwiemer-microsoft@users.noreply.github.com>
Member
|
New plan is to take some time to update the existing Roslyn Language Server heuristic instead of adding a new client-side one. Closing in favor of dotnet/roslyn#84367 and subsequent PRs. Refer to backing issue for full list of refs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authored by @mwiemer-microsoft, closes microsoft/vscode-dotnettools#2369
Adds "convert to project" to FBA entry points based on a simple heuristic. Shells out directly to terminal (
dotnet project convert <file>) to handle interactivity (which may change in future SDK versions). The command is available in the editor, explorer, and command palette.C# files are identified as ones ending in
.csor open files with the VS Code language association of C#.All C# files are considered possible FBAs by default. We ignore files that have a
csproj"in cone." We then un-ignore files with FBA-specific code, like#!shebang or#:FBA-specific directives.When running from command palette, we find likely FBAs using the above heuristic on all
*.csfiles in the workspace and all open C# files.