public static string GetFolderPath(this IVsComponentModelHost componentModelHost) { string folderPath; componentModelHost.GetCatalogCacheFolder(out folderPath); return(folderPath); }
public static async Task <string> GetFolderPathAsync(this IVsComponentModelHost componentModelHost) { if (!ThreadHelper.CheckAccess()) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); } componentModelHost.GetCatalogCacheFolder(out string folderPath); return(folderPath); }
private static void OpenErrorFile(IVsComponentModelHost componentModelHost, DTE dte) { var file = componentModelHost.GetDefaultErrorFile(); if (!File.Exists(file)) { dte.StatusBar.Text = $"Couldn't find file at '{file}'."; return; } dte.ItemOperations.OpenFile(file); }
//Clear the MEF Cache public static async System.Threading.Tasks.Task ClearAsync() { if (!ThreadHelper.CheckAccess()) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); } IVsComponentModelHost componentModelHost = await Instance.ServiceProvider.GetServiceAsync(typeof(SVsComponentModelHost)) as IVsComponentModelHost; string folder = await componentModelHost?.GetFolderPathAsync(); if (!string.IsNullOrEmpty(folder) && Directory.Exists(folder)) { Directory.Delete(folder, true); } }
public static string GetDefaultErrorFile(this IVsComponentModelHost componentModelHost) { var folder = GetFolderPath(componentModelHost); return(Path.Combine(folder, "Microsoft.VisualStudio.Default.err")); }