diff --git a/global.json b/global.json
index ddc6167e..25d48398 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"tools": {
- "dotnet": "7.0.100-rc.1.22431.12"
+ "dotnet": "8.0.100"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22480.2"
diff --git a/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj b/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj
index 4ffb13f3..51e4d91d 100644
--- a/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj
+++ b/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj
@@ -1,13 +1,13 @@
- netcoreapp3.1
+ net8.0
Microsoft.Build.Logging.Query
preview
-
+
diff --git a/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs b/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs
index 0e7abf04..a76d7d1e 100644
--- a/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs
+++ b/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs
@@ -133,13 +133,13 @@ private static bool IsAdmin()
{
try
{
- if (RuntimeInfo.RunningOnWindows)
+ if (OperatingSystem.IsWindows())
{
var identity = WindowsIdentity.GetCurrent();
var principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
- else if (RuntimeInfo.RunningOnOSX)
+ else if (OperatingSystem.IsMacOS())
{
return getuid() == 0;
}
diff --git a/src/dotnet-core-uninstall/Shared/Configs/CommandLineConfigs.cs b/src/dotnet-core-uninstall/Shared/Configs/CommandLineConfigs.cs
index fb941947..e3ebbc87 100644
--- a/src/dotnet-core-uninstall/Shared/Configs/CommandLineConfigs.cs
+++ b/src/dotnet-core-uninstall/Shared/Configs/CommandLineConfigs.cs
@@ -8,6 +8,7 @@
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.Linq;
+using System.Runtime.InteropServices;
using Microsoft.DotNet.Tools.Uninstall.MacOs;
using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo;
using Microsoft.DotNet.Tools.Uninstall.Shared.Commands;
@@ -231,7 +232,7 @@ static CommandLineConfigs()
}
AssignOptionsToCommand(ListCommand, ListAuxOptions);
- var bundleCollector = RuntimeInfo.RunningOnWindows ? new RegistryQuery() as IBundleCollector : new FileSystemExplorer() as IBundleCollector;
+ var bundleCollector = OperatingSystem.IsWindows() ? new RegistryQuery() as IBundleCollector : new FileSystemExplorer() as IBundleCollector;
ListCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => ListCommandExec.Execute(bundleCollector)));
DryRunCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => DryRunCommandExec.Execute(bundleCollector)));
RemoveCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => UninstallCommandExec.Execute(bundleCollector)));
diff --git a/src/dotnet-core-uninstall/Windows/RegistryQuery.cs b/src/dotnet-core-uninstall/Windows/RegistryQuery.cs
index 9762bc8c..93767e20 100644
--- a/src/dotnet-core-uninstall/Windows/RegistryQuery.cs
+++ b/src/dotnet-core-uninstall/Windows/RegistryQuery.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using Microsoft.DotNet.Tools.Uninstall.MacOs;
using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo;
@@ -15,6 +16,7 @@
namespace Microsoft.DotNet.Tools.Uninstall.Windows
{
+ [SupportedOSPlatform("windows")]
internal class RegistryQuery : IBundleCollector
{
public IEnumerable GetInstalledBundles()
diff --git a/src/dotnet-core-uninstall/dotnet-core-uninstall.csproj b/src/dotnet-core-uninstall/dotnet-core-uninstall.csproj
index b7c3682c..eeec6461 100644
--- a/src/dotnet-core-uninstall/dotnet-core-uninstall.csproj
+++ b/src/dotnet-core-uninstall/dotnet-core-uninstall.csproj
@@ -4,7 +4,7 @@
Exe
win-x86;osx-x64
true
- netcoreapp3.1
+ net8.0
LatestMajor
@@ -15,11 +15,11 @@
-
-
+
+
-
+
diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj
index a46ca763..8e846dca 100644
--- a/src/redist/redist.csproj
+++ b/src/redist/redist.csproj
@@ -1,6 +1,6 @@
- netcoreapp3.1
+ net8.0
true
false
false
diff --git a/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj b/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj
index 479fda11..26d9eb38 100644
--- a/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj
+++ b/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
false
diff --git a/test/dotnet-core-uninstall.Tests/Windows/RegistryQueryTests.cs b/test/dotnet-core-uninstall.Tests/Windows/RegistryQueryTests.cs
index 8baa1b91..3132a3ba 100644
--- a/test/dotnet-core-uninstall.Tests/Windows/RegistryQueryTests.cs
+++ b/test/dotnet-core-uninstall.Tests/Windows/RegistryQueryTests.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+using System;
using FluentAssertions;
using Microsoft.DotNet.Tools.Uninstall.Tests.Attributes;
using Microsoft.DotNet.Tools.Uninstall.Windows;
@@ -48,9 +49,12 @@ public class RegistryQueryTests
[InlineData("Microsoft .NET SDK 5.0.100 (arm64)")]
internal void TestIsNetCoreBundleAccept(string input)
{
- RegistryQuery.IsNetCoreBundle(input, "0.0", "mockuninstall.exe", "0.0")
- .Should()
- .BeTrue();
+ if (OperatingSystem.IsWindows())
+ {
+ RegistryQuery.IsNetCoreBundle(input, "0.0", "mockuninstall.exe", "0.0")
+ .Should()
+ .BeTrue();
+ }
}
[WindowsOnlyTheory]
@@ -58,9 +62,12 @@ internal void TestIsNetCoreBundleAccept(string input)
[InlineData("Microsoft .NET Core SDK - rc1 (x86)")]
internal void TestGetBundleVersionReturnsNullOnInvalidDisplayNames(string displayName)
{
- RegistryQuery.GetBundleVersion(displayName, string.Empty, string.Empty)
+ if (OperatingSystem.IsWindows())
+ {
+ RegistryQuery.GetBundleVersion(displayName, string.Empty, string.Empty)
.Should()
.BeNull();
+ }
}
}
}
diff --git a/test/dotnet-core-uninstall.Tests/dotnet-core-uninstall.Tests.csproj b/test/dotnet-core-uninstall.Tests/dotnet-core-uninstall.Tests.csproj
index 6271bc57..abfcfdca 100644
--- a/test/dotnet-core-uninstall.Tests/dotnet-core-uninstall.Tests.csproj
+++ b/test/dotnet-core-uninstall.Tests/dotnet-core-uninstall.Tests.csproj
@@ -1,6 +1,6 @@
- net7.0
+ net8.0