Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,17 @@ jobs:

- name: Trust HTTPS development certificate (Linux)
if: inputs.os == 'ubuntu-latest'
run: ${{ env.DOTNET_SCRIPT }} dev-certs https --trust
# Allow the task to succeed on partial trust.
# Remove this workaround once https://github.com/dotnet/aspnetcore/pull/65392 has shipped
run: |
EXIT_CODE=0
${{ env.DOTNET_SCRIPT }} dev-certs https --trust || EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 4 ]; then
echo "dev-certs https --trust failed with exit code $EXIT_CODE"
exit $EXIT_CODE
fi
env:
WSL_INTEROP: ""

- name: Verify Docker is running
# nested docker containers not supported on windows
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.101",
"version": "10.0.103",
"rollForward": "major",
"allowPrerelease": true,
"paths": [
Expand All @@ -10,7 +10,7 @@
"errorMessage": "The .NET SDK could not be found. Run ./restore.sh (Linux/macOS) or ./restore.cmd (Windows) to install the local SDK."
},
"tools": {
"dotnet": "10.0.101",
"dotnet": "10.0.103",
"runtimes": {
"dotnet/x64": [
"$(DotNetRuntimePreviousVersionForTesting)",
Expand Down
9 changes: 6 additions & 3 deletions src/Aspire.Cli/DotNet/DotNetCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public async Task<int> TrustHttpCertificateAsync(DotNetCliRunnerInvocationOption
}
}

private static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen(true)] out string? version)
internal static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen(true)] out string? version)
{
var lines = stdout.Split(Environment.NewLine);
var successLine = lines.SingleOrDefault(x => x.StartsWith("Success: Aspire.ProjectTemplates"));
Expand All @@ -461,9 +461,12 @@ private static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen
}

var templateVersion = successLine.Split(" ") switch { // Break up the success line.
{ Length: > 2 } chunks => chunks[1].Split("::") switch { // Break up the template+version string
{ Length: > 2 } chunks => chunks[1].Split("@") switch { // Break up the template+version string (@ separator for .NET 10.0+)
{ Length: 2 } versionChunks => versionChunks[1], // The version in the second chunk
_ => null
_ => chunks[1].Split("::") switch { // Fallback to :: separator for older SDK versions
{ Length: 2 } versionChunks => versionChunks[1],
_ => null
}
},
_ => null
};
Expand Down
15 changes: 15 additions & 0 deletions tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,21 @@ await runner.GetProjectItemsAndPropertiesAsync(
CancellationToken.None
);
}

[Theory]
[InlineData("Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // New .NET 10.0 SDK format with @ separator
[InlineData("Success: Aspire.ProjectTemplates::13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // Old SDK format with :: separator
[InlineData("Some other output", false, null)] // Missing success line
[InlineData("Success: Aspire.ProjectTemplates installed the following templates:", false, null)] // Invalid format without version separator
public void TryParsePackageVersionFromStdout_ParsesCorrectly(string stdout, bool expectedResult, string? expectedVersion)
{
// Act
var result = DotNetCliRunner.TryParsePackageVersionFromStdout(stdout, out var version);

// Assert
Assert.Equal(expectedResult, result);
Assert.Equal(expectedVersion, version);
}
}

internal sealed class AssertingDotNetCliRunner(
Expand Down
Loading