Пример #1
0
        /// <summary>
        /// Add a new error/warning/message tag into the given target
        /// </summary>
        internal static ProjectTaskElement AddErrorWarningMessageElement
            (
            ProjectTargetElement target,
            string elementType,
            bool treatAsLiteral,
            string textResourceName,
            params object[] args
            )
        {
            string code = null;
            string helpKeyword = null;
            string text = ResourceUtilities.FormatResourceString(out code, out helpKeyword, textResourceName, args);

            if (treatAsLiteral)
            {
                text = EscapingUtilities.Escape(text);
            }

            ProjectTaskElement task = target.AddTask(elementType);
            task.SetParameter("Text", text);

            if ((elementType != XMakeElements.message) && (code != null))
            {
                task.SetParameter("Code", EscapingUtilities.Escape(code));
            }

            if ((elementType != XMakeElements.message) && (helpKeyword != null))
            {
                task.SetParameter("HelpKeyword", EscapingUtilities.Escape(helpKeyword));
            }

            return task;
        }
Пример #2
0
 static void addCreateItem(ProjectTargetElement v0, string includeValue, string condition, string meta, string outItemName)
 {
     var v2 = v0.AddTask("CreateItem");
     v2.SetParameter("Include", includeValue);
     if (!string.IsNullOrEmpty(meta))
         v2.SetParameter("AdditionalMetadata", meta);
     if (!string.IsNullOrEmpty(condition))
         v2.Condition = condition;
     v2.AddOutputItem("Include", outItemName);
 }
Пример #3
0
        static void addCreateProperty(ProjectTargetElement targetElement, string taskValue, string taskCondition, string taskOutputValue)
        {
            var v0 = targetElement.AddTask("CreateProperty");

            v0.SetParameter("Value", taskValue);
            if (!string.IsNullOrEmpty(taskCondition))
                v0.Condition = taskCondition;
            v0.AddOutputProperty("Value", taskOutputValue);
        }
Пример #4
0
        private void GenerateConfigurationPropertyInitializers(ProjectTargetElement initTarget) {
            var pivots = Pivots;
            ProjectPropertyGroupElement pg = null;

            foreach(var pivot in pivots.Values) {
                // dynamic cfg = configurationsView.GetProperty(pivot);
                IEnumerable<string> choices = pivot.Choices.Keys;

                if(!pivot.IsBuiltIn) {
                    // add init steps for this.
                    var finalPropName = "{0}-{1}".format(pivot.Name, SafeName);

                    foreach(var choice in choices.Distinct()) {
                        var choicePropName = "{0}-{1}".format(pivot.Name, choice);
                        
                        var tsk = initTarget.AddTask("StringContains");
                        tsk.SetParameter("Text", choicePropName);
                        tsk.SetParameter("Library", SafeName);
                        tsk.SetParameter("Value", choice);
                        tsk.Condition = @"'$({0})'==''".format(finalPropName);
                        tsk.AddOutputProperty("Result", finalPropName);
                    }
                    pg = pg ?? Xml.AddPropertyGroup();
                    pg.Label = "Default initializers for properties";
                    pg.AddProperty(finalPropName, choices.FirstOrDefault()).Condition = @"'$({0})' == ''".format(finalPropName);
                }
            }
        }