diff --git a/src/Microsoft.Unity.Analyzers.Tests/UnityPath.cs b/src/Microsoft.Unity.Analyzers.Tests/UnityPath.cs index 1a352e7..5a277ad 100644 --- a/src/Microsoft.Unity.Analyzers.Tests/UnityPath.cs +++ b/src/Microsoft.Unity.Analyzers.Tests/UnityPath.cs @@ -117,7 +117,14 @@ private static void RegisterRegistryInstallations() private static void RegisterUnityInstallation(string path) { - if (!string.IsNullOrEmpty(path) && Directory.Exists(path)) + if (!string.IsNullOrEmpty(path) && Directory.Exists(path) && HasManagedAssemblies(path)) _unityInstallations.Add(path); } + + private static bool HasManagedAssemblies(string path) + { + // Skip partial installations (uninstall leftovers, stripped editors) + return File.Exists(Path.Combine(path, "Managed", "UnityEditor.dll")) + || File.Exists(Path.Combine(path, "Resources", "Scripting", "Managed", "UnityEditor.dll")); + } }