feat(csharp): add sln-format config option for legacy .sln solution files#13460
feat(csharp): add sln-format config option for legacy .sln solution files#13460patrickthornton merged 10 commits intomainfrom
sln-format config option for legacy .sln solution files#13460Conversation
…on files Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
seed/csharp-sdk/seed.yml
Outdated
| - outputFolder: use-sln-format | ||
| customConfig: | ||
| use-sln-format: true |
There was a problem hiding this comment.
🔴 Missing .sln file in seed test output for use-sln-format fixture
The use-sln-format seed test fixture is missing the generated .sln solution file. The no-custom-config fixture correctly includes SeedSimpleApi.slnx at the root of the output, but the use-sln-format fixture has no corresponding SeedSimpleApi.sln file. This means the seed build/test scripts (seed/csharp-sdk/seed.yml:13) that search for *.slnx or *.sln files will fail to find a solution file, causing dotnet build and dotnet test to fail for this fixture. The .sln file is generated in generators/csharp/base/src/project/CsharpProject.ts:504 using the same absolutePathToSolutionDirectory as the .slnx path, so it should appear in the seed output but does not.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Good catch — the .sln file was being excluded by seed/csharp-sdk/.gitignore which had **/*.sln. Fixed in c6d84b3: removed that rule and added the SeedSimpleApi.sln file to the repo.
… generated file Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
| const slnContents = [ | ||
| "", |
There was a problem hiding this comment.
The .sln file content starts with an empty string, which will produce an invalid solution file that begins with a blank line. Legacy .sln files must start directly with the Visual Studio header without any preceding newlines.
const slnContents = [
"Microsoft Visual Studio Solution File, Format Version 12.00", // Remove the "" from line 476
"# Visual Studio Version 17",
// ... rest of the array
].join("\n");This will cause Visual Studio and dotnet CLI tools to potentially reject or misparse the solution file.
| const slnContents = [ | |
| "", | |
| const slnContents = [ | |
| "Microsoft Visual Studio Solution File, Format Version 12.00", |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Devin check this out
…rp-use-sln-format
Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
|
Can we try to have both sln and slnx when someone wants to use |
…d .slnx when sln Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
|
Done! Updated the config to
Also fixed the leading blank line issue flagged by Graphite. See commit 7eed932. |
use-sln-format config option for legacy .sln solution filessln-format config option for legacy .sln solution files
Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
|
Verify: |
|
@Swimburger Thanks for the review! Here's a quick rundown on each point:
|
|
merge from main |
Co-Authored-By: patrick <patrickthornton@college.harvard.edu>
Description
Refs: Requested by @patrickthornton
Link to Devin Session
Adds a
sln-formatconfiguration option to the C# SDK generator. When set to"sln", the generator produces a legacy.slnsolution file in addition to the default.slnxformat. The default value"slnx"generates only the modern.slnxfile. This is useful for teams that need compatibility with older .NET tooling or CI systems that do not yet support.slnx.Changes Made
sln-formatenum option ("sln" | "slnx") toCsharpConfigSchema.tsslnFormatsetting ingeneration-info.ts(defaults to"slnx")CsharpProject.ts:createSolutionFilealways generates.slnx; whensln-formatis"sln", it additionally generates a legacy.slnfiledotnetFormatalways uses.slnx(present in all configurations)generateDeterministicGuid()helper that hashes the project name via MD5 to produce stable GUIDs for the.slnfile, ensuring reproducible output across generation runsseed.ymlto find both*.slnxand*.slnsolution files**/*.slnfromseed/csharp-sdk/.gitignoreso generated.slnfiles are trackedsimple-api/use-sln-format) with generated snapshot (both.slnand.slnx)versions.yml(version 2.27.0)Testing
simple-api:use-sln-formatpasses (pnpm seed test --generator csharp-sdk --fixture simple-api --outputFolder use-sln-format --skip-scripts)pnpm turbo run compile --filter @fern-api/fern-csharp-sdk).slnformat validity: The generated.slnuses Visual Studio Solution File Format Version 12.00 with theFAE04EC0-301F-11D3-BF4B-00C04F79EFBCproject type GUID. The seed test was run with--skip-scriptsso the.slnwas not validated withdotnet build. Worth verifying that the generated file opens/builds correctly..slnfile is generated with\n(Unix) line endings rather than\r\n(Windows). ModerndotnetCLI handles both, but worth noting for any Windows-specific tooling concerns.SeedSimpleApi.sln)..slnand.slnxexist, thefind | head -n 1in build scripts will pick whichever file is found first. Both should be equivalent, but the ordering is filesystem-dependent..gitignorechange: Removed**/*.slnfromseed/csharp-sdk/.gitignore— needed so the fixture.slnfile is tracked. Verify no other fixtures are affected by this.