private void btnChooseConfig_Click(object sender, EventArgs e) { var path = CurrentItem.Path; if (!Path.IsPathRooted(path)) { path = Path.Combine( Path.GetDirectoryName(this.CurrentBuildFile.FileName), path); } var conf = ProjectConfigurationsForm.Show(path); CurrentItem.PlatformName = conf.Platform; CurrentItem.ConfigurationName = conf.Name; }
public static ProjectConfiguration Show(string filename) { var ext = Path.GetExtension(filename); BaseVsProject vsProject = null; switch (ext.ToLower()) { case ".vcproj": vsProject = VcProject.Parse(filename); break; case ".csproj": vsProject = CSharpProject.Parse(filename); break; case ".dsp": vsProject = VisualCpp6Project.Parse(filename); break; default: MessageBox.Show("Project file not recognized"); return(null); } var f = new ProjectConfigurationsForm(); foreach (var cfg in vsProject.Configurations) { var item = f.listView.Items.Add(cfg.Name); item.SubItems.Add(cfg.Platform); item.Tag = cfg; } if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { return(f.listView.SelectedItems[0].Tag as ProjectConfiguration); } return(null); }