-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/8.2] Allow referencing older version of AppHost package for …
…backward compatibility (#5708) * Allow referencing older version of AppHost package for backward compatibility * Remove unnecessary using statement * Rename test --------- Co-authored-by: Jose Perez Rodriguez <[email protected]>
- Loading branch information
1 parent
234ce65
commit 1569ae1
Showing
7 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Xunit; | ||
using Xunit.Abstractions; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Aspire.Workload.Tests; | ||
|
||
public partial class AppHostTemplateTests : WorkloadTestsBase | ||
{ | ||
public AppHostTemplateTests(ITestOutputHelper testOutput) | ||
: base(testOutput) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task EnsureProjectsReferencing8_1_0AppHostWithNewerWorkloadCanBuild() | ||
{ | ||
string projectId = "aspire-can-reference-8.1.0"; | ||
await using var project = await AspireProject.CreateNewTemplateProjectAsync( | ||
projectId, | ||
"aspire-apphost", | ||
_testOutput, | ||
BuildEnvironment.ForDefaultFramework, | ||
string.Empty, | ||
false); | ||
|
||
var projectPath = Path.Combine(project.RootDir, $"{projectId}.csproj"); | ||
|
||
// Replace the reference to Aspire.Hosting.AppHost with version 8.1.0 | ||
var newContents = AppHostPackageReferenceRegex().Replace(File.ReadAllText(projectPath), @"$1""8.1.0"""); | ||
|
||
File.WriteAllText(projectPath, newContents); | ||
|
||
// Ensure project builds successfully | ||
await project.BuildAsync(workingDirectory: project.RootDir); | ||
} | ||
|
||
[GeneratedRegex(@"(PackageReference\s.*""Aspire\.Hosting\.AppHost.*Version=)""[^""]+""")] | ||
private static partial Regex AppHostPackageReferenceRegex(); | ||
} |
This file contains 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
This file contains 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