コード例 #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));
        }
コード例 #2
0
ファイル: MSBuildProject.cs プロジェクト: Kalnor/monodevelop
		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);
		}