Example #1
0
        public MSBuildImport AddNewImport(string name, MSBuildImport beforeImport = null)
        {
            XmlElement elem = doc.CreateElement(null, "Import", MSBuildProject.Schema);

            elem.SetAttribute("Project", name);

            if (beforeImport != null)
            {
                doc.DocumentElement.InsertBefore(elem, beforeImport.Element);
            }
            else
            {
                XmlElement last = doc.DocumentElement.SelectSingleNode("tns:Import[last()]", XmlNamespaceManager) as XmlElement;
                if (last != null)
                {
                    doc.DocumentElement.InsertAfter(elem, last);
                }
                else
                {
                    doc.DocumentElement.AppendChild(elem);
                }
            }
            return(new MSBuildImport(elem));
        }
Example #2
0
		public MSBuildImport AddNewImport (string name, MSBuildImport beforeImport = null)
		{
			XmlElement elem = doc.CreateElement (null, "Import", MSBuildProject.Schema);
			elem.SetAttribute ("Project", name);

			if (beforeImport != null) {
				doc.DocumentElement.InsertBefore (elem, beforeImport.Element);
			} else {
				XmlElement last = doc.DocumentElement.SelectSingleNode ("tns:Import[last()]", XmlNamespaceManager) as XmlElement;
				if (last != null)
					doc.DocumentElement.InsertAfter (elem, last);
				else
					doc.DocumentElement.AppendChild (elem);
			}
			return new MSBuildImport (elem);
		}