Skip to content

[http-client-csharp] Switch scaffolding to generate .slnx instead of .sln#10234

Merged
ArcturusZhang merged 5 commits into
mainfrom
copilot/http-client-csharp-switch-scenx
Apr 7, 2026
Merged

[http-client-csharp] Switch scaffolding to generate .slnx instead of .sln#10234
ArcturusZhang merged 5 commits into
mainfrom
copilot/http-client-csharp-switch-scenx

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Fixes #4065
Fixes #10233

Per latest .NET guidelines, new projects should use the XML-based .slnx solution format rather than the legacy .sln format.

Changes

  • NewProjectScaffolding.cs: Replace .sln generation with .slnx. The verbose GUIDs-and-config .sln content is replaced with the minimal XML format. Cleanup in Execute() now handles both .sln (backward compat) and .slnx.
  • CommandLineOptions.cs: Updated help text to reference slnx.
  • Test projects: Regenerated all 72 test project solution files as .slnx.

Generated .slnx output:

<Solution>
  <Project Path="src\PackageName.csproj" />
</Solution>

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/cdbacd32-d08e-436b-b54f-b117d2ad257b

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Apr 1, 2026
Copilot AI changed the title [WIP] Switch scaffolding to create slnx instead of sln [http-client-csharp] Switch scaffolding to generate .slnx instead of .sln Apr 1, 2026
Copilot AI requested a review from ArcturusZhang April 1, 2026 04:37
@ArcturusZhang ArcturusZhang marked this pull request as ready for review April 3, 2026 00:16
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@10234

commit: 2e4a9b4

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

No changes needing a change description found.

@ArcturusZhang
Copy link
Copy Markdown
Member

@copilot fix the spell check issue.

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/2418706f-1368-4179-9e6a-d2905f32142b

Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot fix the spell check issue.

Added slnx to the cspell dictionary in cspell.yaml (79fb070).

Add a protected virtual WriteAdditionalFiles() method that subclasses can
override to emit custom files (ci.yml, .targets, etc.) during new project
scaffolding. Called from Execute() after solution and project files are written.

Fixes #4065

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ArcturusZhang ArcturusZhang added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit 28cea40 Apr 7, 2026
31 checks passed
@ArcturusZhang ArcturusZhang deleted the copilot/http-client-csharp-switch-scenx branch April 7, 2026 04:09
github-merge-queue Bot pushed a commit that referenced this pull request Apr 8, 2026
Fixes cross-platform compatibility issue introduced in #10234.

### Problem

The \.slnx\ solution files generated by \NewProjectScaffolding\ used
backslashes (\src\Package.csproj\) which is Windows-specific and may not
resolve correctly on Linux/macOS.

### Changes

- **\NewProjectScaffolding.cs\**: Changed \src\{0}.csproj\ to
\src/{0}.csproj\ in \GetSolutionFileContent()\
- **Test projects**: Updated all 72 generated \.slnx\ files to use
forward slashes
- **\NewProjectScaffoldingTests.cs\**: Added test
\Execute_SlnxUsesForwardSlashes\ to verify forward slashes are used in
the generated content

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
msyyc pushed a commit that referenced this pull request Apr 9, 2026
Fixes cross-platform compatibility issue introduced in #10234.

### Problem

The \.slnx\ solution files generated by \NewProjectScaffolding\ used
backslashes (\src\Package.csproj\) which is Windows-specific and may not
resolve correctly on Linux/macOS.

### Changes

- **\NewProjectScaffolding.cs\**: Changed \src\{0}.csproj\ to
\src/{0}.csproj\ in \GetSolutionFileContent()\
- **Test projects**: Updated all 72 generated \.slnx\ files to use
forward slashes
- **\NewProjectScaffoldingTests.cs\**: Added test
\Execute_SlnxUsesForwardSlashes\ to verify forward slashes are used in
the generated content

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http-client-csharp] switch the scaffolding to create slnx instead of sln Add extensibility to new project scaffolding

3 participants