private VSProjectConfiguration ReadPropertyGroup(XmlReader xmlReader) { VSProjectConfiguration configuration = new VSProjectConfiguration(); if (xmlReader["Condition"] != null && propertiesDictionary == false) { configuration.Condition = xmlReader["Condition"]; } xmlReader.Read(); while (xmlReader.NodeType != XmlNodeType.EndElement) { if (propertiesDictionary) { if (properties.ContainsKey(xmlReader.Name)) { throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Property '{0}' Ya se ha añadido al grupo. VS project '{1}'", xmlReader.Name, ProjectFileName)); } properties.Add(xmlReader.Name, xmlReader.ReadElementContentAsString()); } else { if (configuration.Properties.ContainsKey(xmlReader.Name)) { throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Property '{0}' Ya se ha añadido al grupo. VS project '{1}'", xmlReader.Name, ProjectFileName)); } configuration.Properties.Add(xmlReader.Name, xmlReader.ReadElementContentAsString()); } } return(configuration); }
private VSProjectConfiguration ReadPropertyGroup(XmlReader xmlReader) { VSProjectConfiguration configuration = new VSProjectConfiguration(); if (xmlReader["Condition"] != null && propertiesDictionary == false) { configuration.Condition = xmlReader["Condition"]; } xmlReader.Read(); while (xmlReader.NodeType != XmlNodeType.EndElement) { if (propertiesDictionary) { if (properties.ContainsKey(xmlReader.Name)) throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Property '{0}' Ya se ha añadido al grupo. VS project '{1}'", xmlReader.Name, ProjectFileName)); properties.Add(xmlReader.Name, xmlReader.ReadElementContentAsString()); } else { if (configuration.Properties.ContainsKey(xmlReader.Name)) throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Property '{0}' Ya se ha añadido al grupo. VS project '{1}'", xmlReader.Name, ProjectFileName)); configuration.Properties.Add(xmlReader.Name, xmlReader.ReadElementContentAsString()); } } return configuration; }
private void ReadBuildConfigSettings(XmlReader xmlReader) { string assemblyname = ""; string outputtype = ""; xmlReader.Read(); if (xmlReader.Name == "Settings") { assemblyname = xmlReader["AssemblyName"]; outputtype = xmlReader["OutputType"]; properties.Add("AssemblyName", assemblyname); properties.Add("OutputType", outputtype); } //Leer las dos configuraciones, si existen... xmlReader.Read(); //Supuestamente Debug... while (xmlReader.NodeType != XmlNodeType.EndElement) { if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair<string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); //Supuestamente Release... if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair<string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); } xmlReader.Read(); if (xmlReader.Name == "References") { xmlReader.Read(); while (xmlReader.Name == "Reference") { try { string refname = xmlReader["Name"]; VSProjectItem item = new VSProjectItem(VSProjectItem.Reference); item.Item = refname; item.ItemProperties.Add(new KeyValuePair<string, string>("AssemblyName", xmlReader["AssemblyName"])); if (xmlReader["HintPath"] != null && xmlReader["HintPath"] != "") { item.ItemProperties.Add(new KeyValuePair<string, string>("HintPath", xmlReader["HintPath"])); } items.Add(item); } catch (Exception ex) { } finally { xmlReader.Read(); } } } xmlReader.Read(); if (xmlReader.Name == "Imports") { xmlReader.Read(); while (xmlReader.Name == "Import") { xmlReader.Read(); } xmlReader.Read(); } }
private void ReadBuildConfigSettings(XmlReader xmlReader) { string assemblyname = ""; string outputtype = ""; xmlReader.Read(); if (xmlReader.Name == "Settings") { assemblyname = xmlReader["AssemblyName"]; outputtype = xmlReader["OutputType"]; properties.Add("AssemblyName", assemblyname); properties.Add("OutputType", outputtype); } //Leer las dos configuraciones, si existen... xmlReader.Read(); //Supuestamente Debug... while (xmlReader.NodeType != XmlNodeType.EndElement) { if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair <string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); //Supuestamente Release... if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair <string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); } xmlReader.Read(); if (xmlReader.Name == "References") { xmlReader.Read(); while (xmlReader.Name == "Reference") { try { string refname = xmlReader["Name"]; VSProjectItem item = new VSProjectItem(VSProjectItem.Reference); item.Item = refname; item.ItemProperties.Add(new KeyValuePair <string, string>("AssemblyName", xmlReader["AssemblyName"])); if (xmlReader["HintPath"] != null && xmlReader["HintPath"] != "") { item.ItemProperties.Add(new KeyValuePair <string, string>("HintPath", xmlReader["HintPath"])); } items.Add(item); } catch (Exception ex) { } finally { xmlReader.Read(); } } } xmlReader.Read(); if (xmlReader.Name == "Imports") { xmlReader.Read(); while (xmlReader.Name == "Import") { xmlReader.Read(); } xmlReader.Read(); } }