private void IncludeFilesInProject(string csProjName, string tagContent)
{
string csprojPath = txtdefaultPath.Text + "\\" + csProjName;
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load(csprojPath);
XmlTextReader reader = new XmlTextReader(csprojPath);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode currNode;
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
docFrag.InnerXml = tagContent;
// insert the availability node into the document
currNode = doc.DocumentElement;
currNode.InsertAfter(docFrag, currNode.LastChild);
//save the output to a file
doc.Save(csprojPath);
//Overwrite the existing file with new file content.
string projFile = File.ReadAllText(csprojPath);
string newProjFile = projFile.Replace(" xmlns=\"\"", "");
File.WriteAllText(csprojPath, newProjFile);
}
{
string csprojPath = txtdefaultPath.Text + "\\" + csProjName;
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load(csprojPath);
XmlTextReader reader = new XmlTextReader(csprojPath);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode currNode;
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
docFrag.InnerXml = tagContent;
// insert the availability node into the document
currNode = doc.DocumentElement;
currNode.InsertAfter(docFrag, currNode.LastChild);
//save the output to a file
doc.Save(csprojPath);
//Overwrite the existing file with new file content.
string projFile = File.ReadAllText(csprojPath);
string newProjFile = projFile.Replace(" xmlns=\"\"", "");
File.WriteAllText(csprojPath, newProjFile);
}