fix: generate .csproj projects instead of #r scripts#42
Merged
Conversation
- Replace single-file .cs with client/Program.cs + client/client.csproj - Replace single-file .cs with upgrade/Program.cs + upgrade/upgrade.csproj - Use dotnet run --project . instead of dotnet run script.cs - #r directives are not supported in .cs files by .NET 10 - .csproj approach is more reliable, no NuGet version issues
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the simulation workflow to generate and run full console projects (.csproj + Program.cs) for the client and upgrade steps, replacing the previous #r-based C# script approach.
Changes:
- Generate
client/client.csproj + Program.csandupgrade/upgrade.csproj + Program.csinstead ofclient.cs/upgrade.csscripts. - Update simulation execution to run the generated projects via
dotnet run --project .from each generated directory. - Update logging/messages to reflect the project-based generation/execution flow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Services/SimulationService.cs | Switches simulation runtime from script execution to running generated project directories via dotnet run. |
| src/Services/ClientGeneratorService.cs | Replaces script templates with .csproj + Program.cs templates and writes them into client/ and upgrade/ subfolders. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+139
to
149
| await File.WriteAllTextAsync(Path.Combine(clientDir, "Program.cs"), | ||
| string.Format(ClientProgram, | ||
| EscapeForCSharp(config.AppDirectory), | ||
| serverUrl, | ||
| "upgrade.exe", // AppName | ||
| "client.exe", // MainAppName | ||
| config.CurrentVersion, | ||
| "1.0.0.0", // upgrade client version | ||
| config.ProductId, | ||
| config.AppSecretKey), | ||
| Encoding.UTF8); |
Comment on lines
+156
to
+157
| string.Format(UpgradeProgram, | ||
| EscapeForCSharp(config.AppDirectory)), |
Comment on lines
+23
to
+27
| <ItemGroup> | ||
| <PackageReference Include="GeneralUpdate.ClientCore" Version="10.*" /> | ||
| <PackageReference Include="GeneralUpdate.Core" Version="10.*" /> | ||
| </ItemGroup> | ||
| </Project> |
Comment on lines
+91
to
+92
| <PackageReference Include="GeneralUpdate.Core" Version="10.*" /> | ||
| <PackageReference Include="GeneralUpdate.ClientCore" Version="10.*" /> |
| @@ -57,14 +57,14 @@ public async Task<SimulationResult> RunAsync( | |||
| config.ServerPort = _server.Port; | |||
|
|
|||
| // 4. Generate client/upgrade scripts | |||
| Log("STEP 5: Running client (dotnet run client.cs)", progress); | ||
| var clientResult = await RunDotNetScript(config.OutputDirectory, "client.cs", ct); | ||
| // 5. Run client via dotnet run --project | ||
| Log("STEP 5: Running client (dotnet run --project client)", progress); |
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.
Replace #r NuGet scripts with proper .csproj projects:
Build: 0 errors