/// <summary> /// Delete the native images of an assembly and its dependencies from the native image cache. /// </summary> /// <param name="assembly">Path of the assembly or full display name.</param> /// <returns>True if uninstallation succeeded, or False if the assembly is not installed.</returns> public static bool UninstallAssembly(string assembly) { using (var ngenLauncher = new NgenLauncher()) { ngenLauncher.UninstallAssembly(assembly); ngenLauncher.WaitForExit(); return ngenLauncher.IsSuccessful; } }
/// <summary> /// Check if the native image for an assembly has been installed. /// </summary> /// <param name="assembly">Path of the assembly or full display name.</param> /// <remarks>Referenced assemblies are not included in the check.</remarks> public static bool IsAssemblyInstalled(string assembly) { using (var ngenLauncher = new NgenLauncher()) { ngenLauncher.DisplayAssembly(assembly); ngenLauncher.WaitForExit(); return ngenLauncher.IsSuccessful; } }