public static void AddToProject(Form owner, string configName) { TestLoader loader = Services.TestLoader; ProjectConfig config = configName == null ? loader.TestProject.ActiveConfig : loader.TestProject.Configs[configName]; OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Add Assemblies To Project"; dlg.InitialDirectory = config.BasePath; if (VisualStudioSupport) { dlg.Filter = "Projects & Assemblies(*.csproj,*.vbproj,*.vjsproj, *.vcproj,*.dll,*.exe )|*.csproj;*.vjsproj;*.vbproj;*.vcproj;*.dll;*.exe|" + "Visual Studio Projects (*.csproj,*.vjsproj,*.vbproj,*.vcproj)|*.csproj;*.vjsproj;*.vbproj;*.vcproj|" + "C# Projects (*.csproj)|*.csproj|" + "J# Projects (*.vjsproj)|*.vjsproj|" + "VB Projects (*.vbproj)|*.vbproj|" + "C++ Projects (*.vcproj)|*.vcproj|" + "Assemblies (*.dll,*.exe)|*.dll;*.exe"; } else { dlg.Filter = "Assemblies (*.dll,*.exe)|*.dll;*.exe"; } dlg.FilterIndex = 1; dlg.FileName = ""; if (dlg.ShowDialog(owner) != DialogResult.OK) { return; } if (PathUtils.IsAssemblyFileType(dlg.FileName)) { config.Assemblies.Add(dlg.FileName); } else if (VSProject.IsProjectFile(dlg.FileName)) { try { VSProject vsProject = new VSProject(dlg.FileName); MessageBoxButtons buttons; string msg; if (configName != null && vsProject.Configs.Contains(configName)) { msg = "The project being added may contain multiple configurations;\r\r" + "Select\tYes to add all configurations found.\r" + "\tNo to add only the " + configName + " configuration.\r" + "\tCancel to exit without modifying the project."; buttons = MessageBoxButtons.YesNoCancel; } else { msg = "The project being added may contain multiple configurations;\r\r" + "Select\tOK to add all configurations found.\r" + "\tCancel to exit without modifying the project."; buttons = MessageBoxButtons.OKCancel; } DialogResult result = UserMessage.Ask(msg, buttons); if (result == DialogResult.Yes || result == DialogResult.OK) { loader.TestProject.Add(vsProject); if (loader.IsTestLoaded) { loader.ReloadTest(); } else { loader.LoadTest(); } } else if (result == DialogResult.No) { foreach (string assembly in vsProject.Configs[configName].Assemblies) { config.Assemblies.Add(assembly); } } } catch (Exception ex) { UserMessage.DisplayFailure(ex.Message, "Invalid VS Project"); } } }