Inheritance: MSBuildObject
Example #1
0
        public void RemoveProperty(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop != null)
            {
                properties.Remove(name);
                Element.RemoveChild(prop.Element);
            }
        }
Example #2
0
 public void UnMerge(MSBuildPropertyGroup baseGrp)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         MSBuildProperty thisProp = GetProperty(prop.Name);
         if (thisProp != null && prop.Value == thisProp.Value)
         {
             RemoveProperty(prop.Name);
         }
     }
 }
        public bool RemoveProperty(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop != null)
            {
                properties.Remove(name);
                Element.RemoveChild(prop.Element);
                return(true);
            }
            return(false);
        }
Example #4
0
        public void SetPropertyValue(string name, string value)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                properties [name] = prop;
            }
            prop.Value = value;
        }
Example #5
0
        public void SetPropertyValue(string name, string value)
        {
            MSBuildProperty p = GetProperty(name);

            if (p != null)
            {
                p.Value = value;
            }
            else
            {
                groups [0].SetPropertyValue(name, value);
            }
        }
Example #6
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            else
            {
                return(prop.Value);
            }
        }
        public string GetPropertyValue(string name, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            else
            {
                return(prop.GetValue(isXml));
            }
        }
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase, bool isXml = false)
        {
            MSBuildProperty p = GetProperty(name);

            if (p != null)
            {
                if (!preserveExistingCase || !string.Equals(value, p.GetValue(isXml), StringComparison.OrdinalIgnoreCase))
                {
                    p.SetValue(value, isXml);
                }
                return(p);
            }
            return(groups [0].SetPropertyValue(name, value, preserveExistingCase, isXml));
        }
 public void UnMerge(MSBuildPropertySet baseGrp, ISet <string> propsToExclude)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         if (propsToExclude != null && propsToExclude.Contains(prop.Name))
         {
             continue;
         }
         MSBuildProperty thisProp = GetProperty(prop.Name);
         if (thisProp != null && prop.GetValue(true).Equals(thisProp.GetValue(true), StringComparison.OrdinalIgnoreCase))
         {
             RemoveProperty(prop.Name);
         }
     }
 }
 public MSBuildProperty GetProperty(string name)
 {
     // Find property in reverse order, since the last set
     // value is the good one
     for (int n = groups.Count - 1; n >= 0; n--)
     {
         var             g = groups [n];
         MSBuildProperty p = g.GetProperty(name);
         if (p != null)
         {
             return(p);
         }
     }
     return(null);
 }
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                properties [name] = prop;
                prop.SetValue(value, isXml);
            }
            else if (!preserveExistingCase || !string.Equals(value, prop.GetValue(isXml), StringComparison.OrdinalIgnoreCase))
            {
                prop.SetValue(value, isXml);
            }
            return(prop);
        }
Example #12
0
        public MSBuildPropertyGroup(MSBuildProject parent, XmlElement elem) : base(elem)
        {
            this.parent = parent;

            foreach (var pelem in Element.ChildNodes.OfType <XmlElement> ())
            {
                MSBuildProperty prevSameName;
                if (properties.TryGetValue(pelem.Name, out prevSameName))
                {
                    prevSameName.Overwritten = true;
                }

                var prop = new MSBuildProperty(pelem);
                propertyList.Add(prop);
                properties [pelem.Name] = prop;                 // If a property is defined more than once, we only care about the last registered value
            }
        }
        public MSBuildProperty GetProperty(string name)
        {
            MSBuildProperty prop;

            if (properties.TryGetValue(name, out prop))
            {
                return(prop);
            }
            XmlElement propElem = Element [name, MSBuildProject.Schema];

            if (propElem != null)
            {
                prop = new MSBuildProperty(propElem);
                properties [name] = prop;
                return(prop);
            }
            else
            {
                return(null);
            }
        }
        public string GetPropertyValue(string name, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            return(prop != null?prop.GetValue(isXml) : null);
        }
Example #15
0
		public MSBuildProperty SetPropertyValue (string name, string value, bool preserveExistingCase, bool isXml = false)
		{
			MSBuildProperty prop = GetProperty (name);
			if (prop == null) {
				XmlElement pelem = AddChildElement (name);
				prop = new MSBuildProperty (pelem);
				properties [name] = prop;
				prop.SetValue (value, isXml);
			} else if (!preserveExistingCase || !string.Equals (value, prop.GetValue (isXml), StringComparison.OrdinalIgnoreCase)) {
				prop.SetValue (value, isXml);
			}
			return prop;
		}
Example #16
0
		public void SetPropertyValue (string name, string value)
		{
			MSBuildProperty prop = GetProperty (name);
			if (prop == null) {
				XmlElement pelem = AddChildElement (name);
				prop = new MSBuildProperty (pelem);
				properties [name] = prop;
			}
			prop.Value = value;
		}
Example #17
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            return(prop != null ? prop.Value : null);
        }
Example #18
0
		public MSBuildProperty GetProperty (string name)
		{
			MSBuildProperty prop;
			if (properties.TryGetValue (name, out prop))
				return prop;
			XmlElement propElem = Element [name, MSBuildProject.Schema];
			if (propElem != null) {
				prop = new MSBuildProperty (propElem);
				properties [name] = prop;
				return prop;
			}
			else
				return null;
		}
Example #19
0
		public MSBuildPropertyGroup (MSBuildProject parent, XmlElement elem): base (elem)
		{
			this.parent = parent;

			foreach (var pelem in Element.ChildNodes.OfType<XmlElement> ()) {
				MSBuildProperty prevSameName;
				if (properties.TryGetValue (pelem.Name, out prevSameName))
					prevSameName.Overwritten = true;

				var prop = new MSBuildProperty (pelem);
				propertyList.Add (prop);
				properties [pelem.Name] = prop; // If a property is defined more than once, we only care about the last registered value
			}
		}