Example #1
0
        public ProjectEx(
            Microsoft.Build.Framework.ITaskItem projectItem,
            Version version,
            string origProjectPath
            )
        {
            this.m_xmlPath = projectItem.ItemSpec;
            this.version = version;
            m_origProjPath = origProjectPath;

            string deployMetadataValue = projectItem.GetMetadata("Deploy");
            if (deployMetadataValue == "true")
            {
                this.Deploy = true;
            }

            System.Text.RegularExpressions.Regex regex =
                new System.Text.RegularExpressions.Regex(" xmlns=\"http://{0,1}[a-zA-Z0-9/.]*\"+");

            string extraFilesBody = regex.Replace(projectItem.GetMetadata("ExtraFiles"), "");

            string extraFilesXml = string.Format("{0}{1}{2}",
                "<ExtraFiles>",
                extraFilesBody,
                "</ExtraFiles>");

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(extraFilesXml);

            foreach (System.Xml.XmlNode extraFileNode in doc.SelectNodes("ExtraFiles/File"))
            {
                this.AddExtraFile(extraFileNode.Attributes["Name"].Value);
            }
        }
        /// <summary>
        /// Helper for metadata escaping tests
        /// </summary>
        private void SpecialCharactersInMetadataValueTests(Microsoft.Build.Evaluation.ProjectItem item)
        {
            Assert.AreEqual("%3B", item.GetMetadata("EscapedSemicolon").UnevaluatedValue);
            Assert.AreEqual(";", item.GetMetadata("EscapedSemicolon").EvaluatedValue);
            Assert.AreEqual(";", item.GetMetadataValue("EscapedSemicolon"));

            Assert.AreEqual("%24", item.GetMetadata("EscapedDollarSign").UnevaluatedValue);
            Assert.AreEqual("$", item.GetMetadata("EscapedDollarSign").EvaluatedValue);
            Assert.AreEqual("$", item.GetMetadataValue("EscapedDollarSign"));
        }
Example #3
0
 public bool IsActiveConfiguration(Microsoft.Build.BuildEngine.BuildItem item)
 {
     return IsConfiguration(item) &&
        item.HasMetadata("Active") && item.GetMetadata("Active").Equals("true");
 }
Example #4
0
 public bool IsConfiguration(Microsoft.Build.BuildEngine.BuildItem bi)
 {
     return bi.HasMetadata("Type") && bi.GetMetadata("Type").Equals("Config");
 }
Example #5
0
 public void InsertItem(Microsoft.Build.BuildEngine.BuildItem item)
 {
     if (item.HasMetadata("Type"))
     {
         string type = item.GetMetadata("Type");
         switch (type)
         {
             case "Config":
                 InsertConfigItem(item);
                 break;
             case "Assembly":
                 InsertMappingAssembly(item);
                 break;
             case "Mapping":
                 InsertMappingFile(item);
                 break;
         }
     }
 }