コード例 #1
0
        public ProjectItemGroupElement AddItemGroup()
        {
            var item = RootElement.CreateItemGroupElement();

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

            _lastItemGroup.Condition = condition;

            _lastItemGroup.Label = label;

            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Adds an &lt;ItemGroup /&gt; element to the specifed parent.
        /// </summary>
        /// <param name="parent">A parent <see cref="ProjectElementContainer" /> to add the item group to.</param>
        /// <param name="condition">An optional condition to add to the item group.</param>
        /// <param name="label">An optional label to add to the item group.</param>
        /// <returns>The current <see cref="ProjectCreator" />.</returns>
        protected ProjectItemGroupElement ItemGroup(ProjectElementContainer parent, string?condition = null, string?label = null)
        {
            ProjectItemGroupElement itemGroup = RootElement.CreateItemGroupElement();

            parent.AppendChild(itemGroup);

            itemGroup.Condition = condition;

            itemGroup.Label = label;

            return(itemGroup);
        }
コード例 #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));
            }
        }