public BuildScript(string filename) { try { Filename = filename.GetFullPath(); _project = new ProjectPlus(this, Filename + ".msbuild"); _project.Xml.AddImport(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "etc", "MSBuild.ExtensionPack.tasks")); _sheet = new RootPropertySheet(_project); _sheet.ParseFile(Filename); _pivots = new Pivots(_sheet.View.configurations); _sheet.AddChildRoutes(_project.MemberRoutes); // _sheet.AddChildRoutesForType(typeof (ProjectTargetElement), _project.TargetRoutes); _sheet.CurrentView.AddMacroHandler((name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => Environment.GetEnvironmentVariable(name)); // convert #product-info into a dictionary. productInformation = _sheet.Metadata.Value.Keys.Where(each => each.StartsWith("product-info")).ToXDictionary(each => each.Substring(12), each => _sheet.Metadata.Value[each]); } catch(Exception e) { // e.PrintDump(); Dispose(); } }
public BuildScript(string filename) { try { Filename = filename.GetFullPath(); _project = new ProjectPlus(this, Filename + ".msbuild"); _project.Xml.AddImport(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "etc", "MSBuild.ExtensionPack.tasks")); _sheet = new RootPropertySheet(_project); _sheet.ParseFile(Filename); _pivots = new Pivots(_sheet.View.configurations); _sheet.AddChildRoutes(_project.MemberRoutes); // _sheet.AddChildRoutesForType(typeof (ProjectTargetElement), _project.TargetRoutes); _sheet.CurrentView.AddMacroHandler((name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => Environment.GetEnvironmentVariable(name)); // convert #product-info into a dictionary. productInformation = _sheet.Metadata.Value.Keys.Where(each => each.StartsWith("product-info")).ToXDictionary(each => each.Substring(12), each => _sheet.Metadata.Value[each]); } catch { Dispose(); } }