target .NET 9 for upgrade command
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
Command="{Binding UpdateAllProjectsToNet80Command}">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Update all projects in Solution to .NET 8.0
|
||||
Update all projects in Solution to .NET 9.0
|
||||
</TextBlock>
|
||||
</Button>
|
||||
<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}}"
|
||||
Command="{Binding UpdateProjectToNet80Command}">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Update C# Project to .NET 8.0
|
||||
Update C# Project to .NET 9.0
|
||||
</TextBlock>
|
||||
</Button>
|
||||
<Button Grid.Row="3" Grid.Column="0" MinHeight="100" Padding="10" Margin="5"
|
||||
|
||||
@@ -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.");
|
||||
return 1;
|
||||
}
|
||||
Console.WriteLine("Upgrading project to .NET 8.0");
|
||||
Console.WriteLine("Upgrading project to .NET 9.0");
|
||||
await DotNetUpgrade.UpdateProjectAtPathToNet80(settings.CsprojFilePath);
|
||||
|
||||
Console.WriteLine("==================================================");
|
||||
|
||||
@@ -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.");
|
||||
return 1;
|
||||
}
|
||||
Console.WriteLine("Upgrading project to .NET 8.0");
|
||||
Console.WriteLine("Upgrading project to .NET 9.0");
|
||||
await DotNetUpgrade.UpdateProjectsInSolutionToNet80(settings.SolutionFilePath);
|
||||
|
||||
Console.WriteLine("==================================================");
|
||||
|
||||
@@ -33,11 +33,11 @@ public static class DotNetUpgrade
|
||||
var targetFramework = project
|
||||
.PropertyGroups.SelectMany(x => x.Properties)
|
||||
.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();
|
||||
FormatCsproj.FormatCsprojFile(project.FullPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user