Fix additional tests that need to be manually retargeted at 9 and centralize the current tfm
This commit is contained in:
parent
6f7b458acc
commit
c1b4bc93c3
3 changed files with 18 additions and 4 deletions
|
@ -12,6 +12,8 @@ namespace EndToEnd
|
|||
{
|
||||
public class GivenWindowsApp : TestBase
|
||||
{
|
||||
|
||||
|
||||
[WindowsOnlyTheory]
|
||||
[InlineData("10.0.17763.0")]
|
||||
[InlineData("10.0.18362.0")]
|
||||
|
@ -32,6 +34,8 @@ namespace EndToEnd
|
|||
// Update TargetFramework to the right version of .NET Core
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Add(new XElement(ns + "TargetPlatformVersion", targetPlatformVersion));
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Element(ns + "TargetFramework").Value = TestAssetInfo.currentTfm;
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@ namespace EndToEnd.Tests
|
|||
{
|
||||
public class ProjectBuildTests : TestBase
|
||||
{
|
||||
// This is needed each release after we upgrade to 9.0 but the templates haven't been upgraded yet
|
||||
private static readonly string currentTfm = "net9.0";
|
||||
|
||||
[Fact]
|
||||
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
|
||||
{
|
||||
|
@ -31,6 +28,15 @@ namespace EndToEnd.Tests
|
|||
.Execute(newArgs)
|
||||
.Should().Pass();
|
||||
|
||||
string projectPath = Path.Combine(projectDirectory, directory.Name + ".csproj");
|
||||
|
||||
var project = XDocument.Load(projectPath);
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Element(ns + "TargetFramework").Value = TestAssetInfo.currentTfm;
|
||||
project.Save(projectPath);
|
||||
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute()
|
||||
|
@ -76,7 +82,7 @@ namespace EndToEnd.Tests
|
|||
|
||||
project.Root.Attribute("Sdk").Value = "Microsoft.NET.Sdk.Web";
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Element(ns + "TargetFramework").Value = currentTfm;
|
||||
.Element(ns + "TargetFramework").Value = TestAssetInfo.currentTfm;
|
||||
project.Save(projectPath);
|
||||
|
||||
new BuildCommand()
|
||||
|
|
|
@ -11,6 +11,10 @@ namespace Microsoft.DotNet.TestFramework
|
|||
{
|
||||
public class TestAssetInfo
|
||||
{
|
||||
// This is needed each release after we upgrade to 9.0 but the templates haven't been upgraded yet
|
||||
|
||||
public static readonly string currentTfm = "net9.0";
|
||||
|
||||
private readonly string [] FilesToExclude = { ".DS_Store", ".noautobuild" };
|
||||
|
||||
public string AssetName { get; private set; }
|
||||
|
|
Loading…
Reference in a new issue