public string GetDefNamespace() { Microsoft.Build.Evaluation.Project pc = null; try { pc = new Microsoft.Build.Evaluation.Project(FileName); } catch (Exception e) { } if (pc == null) { return(""); } Microsoft.Build.Evaluation.ProjectProperty assname = pc.GetProperty("RootNamespace"); string s = assname.EvaluatedValue; pc.ProjectCollection.UnloadAllProjects(); return(s); }
public string SetProperties(string file) { Microsoft.Build.Evaluation.Project pc = new Microsoft.Build.Evaluation.Project(file); if (pc == null) { return(""); } Microsoft.Build.Evaluation.ProjectProperty outtype = pc.GetProperty("OutputType"); Microsoft.Build.Evaluation.ProjectProperty outdir = pc.GetProperty("OutDir"); Microsoft.Build.Evaluation.ProjectProperty assname = pc.GetProperty("AssemblyName"); string s = outdir.EvaluatedValue + "\\" + assname.EvaluatedValue; pc.ProjectCollection.UnloadAllProjects(); return(s); }
public string GetOutDirs() { Microsoft.Build.Evaluation.Project pc = null; try { pc = new Microsoft.Build.Evaluation.Project(FileName); } catch (Exception e) { } if (pc == null) { return(""); } Microsoft.Build.Evaluation.ProjectProperty outtype = pc.GetProperty("OutputType"); Microsoft.Build.Evaluation.ProjectProperty outdir = pc.GetProperty("OutDir"); Microsoft.Build.Evaluation.ProjectProperty assname = pc.GetProperty("AssemblyName"); string ext = ".dll"; if (outtype.EvaluatedValue == "WinExe") { ext = ".exe"; } string s = Path.GetDirectoryName(FileName) + "\\" + outdir.EvaluatedValue; pc.ProjectCollection.UnloadAllProjects(); return(s); }
public void GetProperties(string config, string platform) { if (pc == null) { return; } SuspendLayout(); //vp.SetProperty("Configuration", config, false); //vp.SetProperty("Platform", platform, false); // vp.SetProperties(config, platform); label3.Enabled = false; comboBox6.Text = "N/A"; comboBox6.Enabled = false; label10.Enabled = false; comboBox7.Text = "N/A"; comboBox7.Enabled = false; try { ArrayList L = VSParsers.frameworks.GetFrameworks(); foreach (string s in L) { comboBox4.Items.Add(s); } } catch (Exception e) { Console.WriteLine(e.Message); }; Microsoft.Build.Evaluation.ProjectProperty outtype = pc.GetProperty("OutputType"); Microsoft.Build.Evaluation.ProjectProperty outdir = pc.GetProperty("OutDir"); Microsoft.Build.Evaluation.ProjectProperty assname = pc.GetProperty("AssemblyName"); Microsoft.Build.Evaluation.ProjectProperty rootassname = pc.GetProperty("RootNamespace"); textBox3.Text = rootassname.EvaluatedValue; comboBox3.Text = assname.EvaluatedValue; string outtypes = outtype.EvaluatedValue; if (outtype.EvaluatedValue == "Library") { outtypes = "Class Library"; } comboBox5.Text = outtypes; textBox9.Text = outdir.EvaluatedValue; comboBox2.Text = "(Not Set)"; string w = vp.GetWarningLevel(); comboBox13.Text = w; w = vp.TreatWarningsAsErrors(); if (w == "false") { radioButton3.Checked = true; radioButton4.Checked = false; radioButton5.Checked = false; } else if (w == "true") { radioButton3.Checked = false; radioButton4.Checked = true; radioButton5.Checked = false; } pc.ProjectCollection.UnloadAllProjects(); //vp.SetProperty("Configuration", config, false); pc.ReevaluateIfNecessary(); InitDefineConstants(); pc.ProjectCollection.UnloadAllProjects(); //LoadSolutionPlatforms(); string ac = pc.DirectoryPath + "\\" + "Properties\\AssemblyInfo.cs"; //assinfo = utils.Assembly.Read(ac); //LoadNA(comboBox6); //LoadNA(comboBox7); //LoadNA(comboBox16); //LoadNA(comboBox15); //LoadNA(comboBox20); //LoadNA(comboBox21); //LoadNA(comboBox31); //LoadNA(comboBox32); //LoadNA(comboBox33); //LoadNA(comboBox34); //LoadNA(comboBox25); //LoadNA(comboBox26); //LoadNA(comboBox29); //LoadNA(comboBox30); //string sc = vp.GetPlatform(); //sc = "Active(" + sc + ")"; //InitPlatform(comboBox10, sc); //InitPlatform(comboBox12, sc); //InitPlatform(comboBox18, sc); //InitPlatform(comboBox22, sc); //sc = vp.GetConfiguration(); //sc = "Active(" + sc + ")"; //InitPlatform(comboBox11, sc); //InitPlatform(comboBox19, sc); //InitPlatform(comboBox23, sc); ResumeLayout(); }
public void GetProperties() { if (pc == null) { return; } label3.Enabled = false; comboBox6.Text = "N/A"; comboBox6.Enabled = false; label10.Enabled = false; comboBox7.Text = "N/A"; comboBox7.Enabled = false; try { ArrayList L = new ArrayList(); ArrayList Fs = GACForm.frameworks; if (Fs != null) { foreach (DirectoryInfo d in Fs) { L.Add(".NET Framework " + d.Name); } } else { L = VSParsers.frameworks.GetFrameworks(); } foreach (string s in L) { comboBox4.Items.Add(s); } } catch (Exception e) { Console.WriteLine(e.Message); }; Microsoft.Build.Evaluation.ProjectProperty outtype = pc.GetProperty("OutputType"); Microsoft.Build.Evaluation.ProjectProperty outdir = pc.GetProperty("OutDir"); Microsoft.Build.Evaluation.ProjectProperty assname = pc.GetProperty("AssemblyName"); Microsoft.Build.Evaluation.ProjectProperty rootassname = pc.GetProperty("RootNamespace"); Microsoft.Build.Evaluation.ProjectProperty OutputPath = pc.GetProperty("OutputPath"); Microsoft.Build.Evaluation.ProjectProperty TargetFramework = pc.GetProperty("TargetFrameworkVersion"); textBox3.Text = rootassname.EvaluatedValue; comboBox3.Text = assname.EvaluatedValue; string outtypes = outtype.EvaluatedValue; if (outtype.EvaluatedValue == "Library") { outtypes = "Class Library"; } comboBox5.Text = outtypes; textBox5.Text = OutputPath.EvaluatedValue; textBox9.Text = outdir.EvaluatedValue; comboBox2.Text = "(Not Set)"; string b = TargetFramework.EvaluatedValue; b = ".NET Framework " + b; int i = comboBox4.FindStringExact(b); if (i >= 0) { comboBox4.SelectedIndex = i; } pc.ProjectCollection.UnloadAllProjects(); string w = vp.GetWarningLevel(); comboBox13.Text = w; w = vp.TreatWarningsAsErrors(); if (w == "false") { radioButton3.Checked = true; radioButton4.Checked = false; radioButton5.Checked = false; } else if (w == "true") { radioButton3.Checked = false; radioButton4.Checked = true; radioButton5.Checked = false; } InitDefineConstants(); LoadSolutionPlatforms(); string ac = pc.DirectoryPath + "\\" + "Properties\\AssemblyInfo.cs"; assinfo = utils.Assembly.Read(ac); LoadNA(comboBox6); LoadNA(comboBox7); LoadNA(comboBox16); LoadNA(comboBox15); LoadNA(comboBox20); LoadNA(comboBox21); LoadNA(comboBox31); LoadNA(comboBox32); LoadNA(comboBox33); LoadNA(comboBox34); LoadNA(comboBox25); LoadNA(comboBox26); LoadNA(comboBox29); LoadNA(comboBox30); string sc = vp.GetPlatform(); sc = "Active(" + sc + ")"; InitPlatform(comboBox10, sc); InitPlatform(comboBox12, sc); InitPlatform(comboBox18, sc); InitPlatform(comboBox22, sc); //if (comboBox10.Items.Contains(sc) == false) // comboBox10.Items.Add(sc); //comboBox10.Text = sc; sc = vp.GetConfiguration(); sc = "Active(" + sc + ")"; InitPlatform(comboBox11, sc); InitPlatform(comboBox19, sc); InitPlatform(comboBox23, sc); //if (comboBox11.Items.Contains(sc) == false) // comboBox11.Items.Add(sc); //comboBox11.Text = sc; comboBox10.Items.Add("x86"); _notloaded = false; }