Skip to content

Commit

Permalink
Simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianAmbrosini committed Apr 26, 2024
1 parent cde0241 commit 33da13f
Showing 1 changed file with 2 additions and 9 deletions.
Expand Up @@ -42,16 +42,9 @@ public static string LatestSdkFolder()
var objectAssemblyDirectory = new FileInfo(objectAssembly.Location).Directory; // C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.4
var dotnetDirectory = objectAssemblyDirectory.Parent.Parent.Parent; // C:\Program Files\dotnet
var sdkDirectory = Path.Combine(dotnetDirectory.FullName, "sdk"); // C:\Program Files\dotnet\sdk
if (!Directory.Exists(sdkDirectory)) // Either not installed locally or .Net Framework
if (!Directory.Exists(sdkDirectory))
{
if (objectAssembly.FullName.Contains("mscorlib"))
{
throw new NotSupportedException($"Razor analysis is only available for .Net Core.");
}
else
{
throw new DirectoryNotFoundException($"Directory not found: {sdkDirectory}");
}
throw new NotSupportedException($"Razor analysis is only supported for .Net Core.");
}
// List of all sdk directories for the major version
var latestSdkMajorDirectories = Directory.GetDirectories(sdkDirectory, $"{objectAssembly.GetName().Version.Major}.*", SearchOption.TopDirectoryOnly);
Expand Down

0 comments on commit 33da13f

Please sign in to comment.