コード例 #1
0
        public ProjectPropertyGroupElement AddPropertyGroup()
        {
            var property = RootElement.CreatePropertyGroupElement();

            AppendChild(property);
            return(property);
        }
コード例 #2
0
        /// <summary>
        /// Adds a &lt;PropertyGroup /&gt; element to the current project.
        /// </summary>
        /// <param name="condition">An optional condition to add to the property group.</param>
        /// <param name="label">An optional label to add to the property group.</param>
        /// <returns>The current <see cref="ProjectCreator" />.</returns>
        public ProjectCreator PropertyGroup(string?condition = null, string?label = null)
        {
            _lastPropertyGroup = AddTopLevelElement(RootElement.CreatePropertyGroupElement());

            _lastPropertyGroup.Condition = condition;

            _lastPropertyGroup.Label = label;

            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Adds a &lt;PropertyGroup /&gt; element to the specified <see cref="ProjectElementContainer" />.
        /// </summary>
        /// <param name="parent">The parent <see cref="ProjectElementContainer" /> to add the property group to.</param>
        /// <param name="condition">An optional condition to add to the property group.</param>
        /// <param name="label">An optional label to add to the property group.</param>
        /// <returns>The <see cref="ProjectElementContainer" /> that was added.</returns>
        protected ProjectPropertyGroupElement PropertyGroup(ProjectElementContainer parent, string?condition = null, string?label = null)
        {
            ProjectPropertyGroupElement propertyGroup = RootElement.CreatePropertyGroupElement();

            parent.AppendChild(propertyGroup);

            propertyGroup.Condition = condition;

            propertyGroup.Label = label;

            return(propertyGroup);
        }
コード例 #4
0
        protected override ProjectElement CreateChildElement(string name)
        {
            switch (name)
            {
            case "PropertyGroup":
                var property = RootElement.CreatePropertyGroupElement();
                AppendChild(property);
                return(property);

            case "ItemGroup":
                var item = RootElement.CreateItemGroupElement();
                AppendChild(item);
                return(item);

            case "When":
                var when = RootElement.CreateWhenElement(null);
                AppendChild(when);
                return(when);

            default:
                throw new InvalidProjectFileException(String.Format(
                                                          "Child \"{0}\" is not a known node type.", name));
            }
        }