public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            return(prop.Value);
        }
Пример #2
0
        public bool RemoveProperty(string name)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop != null)
            {
                this.properties.Remove(name);
                base.Element.RemoveChild(prop.Element);
                return(true);
            }
            return(false);
        }
 public MSBuildProperty GetProperty(string name)
 {
     for (int i = this.groups.Count - 1; i >= 0; i--)
     {
         MSBuildPropertyGroup g = this.groups[i];
         MSBuildProperty      p = g.GetProperty(name);
         if (p != null)
         {
             return(p);
         }
     }
     return(null);
 }
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty p = this.GetProperty(name);

            if (p != null)
            {
                if (!preserveExistingCase || !string.Equals(value, p.Value, StringComparison.OrdinalIgnoreCase))
                {
                    p.Value = value;
                }
                return(p);
            }
            return(this.groups[0].SetPropertyValue(name, value, preserveExistingCase));
        }
Пример #5
0
 public void UnMerge(MSBuildPropertySet baseGrp, ISet <string> propsToExclude)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         if (propsToExclude == null || !propsToExclude.Contains(prop.Name))
         {
             MSBuildProperty thisProp = this.GetProperty(prop.Name);
             if (thisProp != null && prop.Value.Equals(thisProp.Value, StringComparison.CurrentCultureIgnoreCase))
             {
                 this.RemoveProperty(prop.Name);
             }
         }
     }
 }
Пример #6
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = base.AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                this.properties[name] = prop;
                prop.Value            = value;
            }
            else if (!preserveExistingCase || !string.Equals(value, prop.Value, StringComparison.OrdinalIgnoreCase))
            {
                prop.Value = value;
            }
            return(prop);
        }
Пример #7
0
        public MSBuildProperty GetProperty(string name)
        {
            MSBuildProperty prop;

            if (this.properties.TryGetValue(name, out prop))
            {
                return(prop);
            }
            XmlElement propElem = base.Element[name, "http://schemas.microsoft.com/developer/msbuild/2003"];

            if (propElem != null)
            {
                prop = new MSBuildProperty(propElem);
                this.properties[name] = prop;
                return(prop);
            }
            return(null);
        }