private VSProjectConfiguration ReadPropertyGroup(XmlReader xmlReader) { VSProjectConfiguration configuration = new VSProjectConfiguration(); if (xmlReader["Condition"] != null && _propertiesDictionary == false) { configuration.Condition = xmlReader["Condition"]; } xmlReader.Read(); IDictionary <string, string> props = _propertiesDictionary ? _properties : configuration.Properties; while (xmlReader.NodeType != XmlNodeType.EndElement) { if (string.Equals(xmlReader.Name, "PublishDatabaseSettings", StringComparison.OrdinalIgnoreCase)) { xmlReader.Skip(); continue; } string name = xmlReader.Name; string val = xmlReader.ReadElementContentAsString(); if (props.ContainsKey(name)) { continue; } props.Add(name, val); } return(configuration); }
/// <summary> /// Gets the output path for a specified VisualStudio project. The output path is relative /// to the directory where the project file is located. /// </summary> /// <param name="buildConfiguration">The build configuration.</param> /// <returns> /// The output path or <c>null</c> if the project is not compatible. /// </returns> /// <exception cref="ArgumentException">The method could not extract the data from the project file.</exception> public LocalPath GetProjectOutputPath(string buildConfiguration) { // skip non-C# projects if (ProjectTypeGuid != VSProjectType.CSharpProjectType.ProjectTypeGuid && ProjectTypeGuid != VSProjectType.NewCSharpProjectType.ProjectTypeGuid) { return(null); } // find the project configuration string condition = string.Format( CultureInfo.InvariantCulture, "'$(Configuration)|$(Platform)' == '{0}|AnyCPU'", buildConfiguration); VSProjectConfiguration projectConfiguration = ProjectDetails.FindConfiguration(condition); if (projectConfiguration == null) { string message = string.Format( CultureInfo.InvariantCulture, "Could not find '{0}' configuration for the project '{1}'.", condition, ProjectName); throw new ArgumentException(message); } if (projectConfiguration.Properties.ContainsKey("OutputPath") == false) { string message = string.Format( CultureInfo.InvariantCulture, "Missing OutputPath for the '{0}' configuration of the project '{1}'.", buildConfiguration, ProjectName); throw new ArgumentException(message); } return(new LocalPath(projectConfiguration.Properties["OutputPath"])); }