target .NET 9 for upgrade command

This commit is contained in:
Matthew Parker [SSW]
2024-11-13 19:11:18 +10:00
parent 7221780caa
commit dbb5609500
4 changed files with 7 additions and 7 deletions

View File

@@ -106,7 +106,7 @@
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding UpdateAllProjectsToNet80Command}"> Command="{Binding UpdateAllProjectsToNet80Command}">
<TextBlock TextWrapping="Wrap"> <TextBlock TextWrapping="Wrap">
Update all projects in Solution to .NET 8.0 Update all projects in Solution to .NET 9.0
</TextBlock> </TextBlock>
</Button> </Button>
<Button Grid.Row="2" Grid.Column="2" MinHeight="100" Padding="10" Margin="5" <Button Grid.Row="2" Grid.Column="2" MinHeight="100" Padding="10" Margin="5"
@@ -115,7 +115,7 @@
IsEnabled="{Binding CsprojFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" IsEnabled="{Binding CsprojFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding UpdateProjectToNet80Command}"> Command="{Binding UpdateProjectToNet80Command}">
<TextBlock TextWrapping="Wrap"> <TextBlock TextWrapping="Wrap">
Update C# Project to .NET 8.0 Update C# Project to .NET 9.0
</TextBlock> </TextBlock>
</Button> </Button>
<Button Grid.Row="3" Grid.Column="0" MinHeight="100" Padding="10" Margin="5" <Button Grid.Row="3" Grid.Column="0" MinHeight="100" Padding="10" Margin="5"

View File

@@ -18,7 +18,7 @@ public class UpdateProjectToNet80Command : AsyncCommand<UpdateProjectToNet80Comm
Console.WriteLine("Invalid file path. Please pass in a valid file path to a .csproj file."); Console.WriteLine("Invalid file path. Please pass in a valid file path to a .csproj file.");
return 1; return 1;
} }
Console.WriteLine("Upgrading project to .NET 8.0"); Console.WriteLine("Upgrading project to .NET 9.0");
await DotNetUpgrade.UpdateProjectAtPathToNet80(settings.CsprojFilePath); await DotNetUpgrade.UpdateProjectAtPathToNet80(settings.CsprojFilePath);
Console.WriteLine("=================================================="); Console.WriteLine("==================================================");

View File

@@ -18,7 +18,7 @@ public class UpdateSlnToNet80Command : AsyncCommand<UpdateSlnToNet80Command.Sett
Console.WriteLine("Invalid file path. Please pass in a valid file path to a .csproj file."); Console.WriteLine("Invalid file path. Please pass in a valid file path to a .csproj file.");
return 1; return 1;
} }
Console.WriteLine("Upgrading project to .NET 8.0"); Console.WriteLine("Upgrading project to .NET 9.0");
await DotNetUpgrade.UpdateProjectsInSolutionToNet80(settings.SolutionFilePath); await DotNetUpgrade.UpdateProjectsInSolutionToNet80(settings.SolutionFilePath);
Console.WriteLine("=================================================="); Console.WriteLine("==================================================");

View File

@@ -33,11 +33,11 @@ public static class DotNetUpgrade
var targetFramework = project var targetFramework = project
.PropertyGroups.SelectMany(x => x.Properties) .PropertyGroups.SelectMany(x => x.Properties)
.FirstOrDefault(x => x.Name == "TargetFramework"); .FirstOrDefault(x => x.Name == "TargetFramework");
if (targetFramework?.Value is "net8.0" or "net7.0" or "net6.0" or "net5.0") if (targetFramework?.Value is "net9.0" or "net8.0" or "net7.0" or "net6.0" or "net5.0")
{ {
if (targetFramework.Value is not "net8.0") if (targetFramework.Value is not "net9.0")
{ {
targetFramework.Value = "net8.0"; targetFramework.Value = "net9.0";
project.Save(); project.Save();
FormatCsproj.FormatCsprojFile(project.FullPath); FormatCsproj.FormatCsprojFile(project.FullPath);
} }