protected override void LoadNonBuildInformation() { string filepath = this.FileName + ".user"; if (File.Exists(filepath)) { Microsoft.Build.Evaluation.Project pb = new Microsoft.Build.Evaluation.Project(); BuildProject.DisableMarkDirty = true; var projuser = pb.ProjectCollection.LoadProject(filepath); foreach (string key in _userproperties) { try { foreach (var group in projuser.Xml.PropertyGroups) { bool gotit = false; foreach (var p in group.Properties) { if (p.Name == key) { BuildProject.SetGlobalProperty(key, p.Value); OnUserPropertyLoad(key, p.Value); gotit = true; break; } } if (gotit) { break; } } } catch (Exception) { // } } pb.ProjectCollection.UnloadProject(projuser); BuildProject.DisableMarkDirty = false; BuildProject.Save(); } base.LoadNonBuildInformation(); }
public void SetGlobalProperty(string name, string value) { BuildProject.SetGlobalProperty(name, value); }