Esempio n. 1
0
        public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs)
        {
            var xml = XDocument.Load(projectFileName);

            var itemGroupNode = xml.Descendants("ItemGroup");

            if (itemGroupNode.Count() == 0)
            {
                LogErrorEvent(new BuildErrorEventArgs(string.Empty, string.Empty, string.Empty, 0, 0, 0, 0, "Didn't find a project node.", "", ""));
                return(false);
            }
            else if (itemGroupNode.Count() > 1)
            {
                LogErrorEvent(new BuildErrorEventArgs(string.Empty, string.Empty, string.Empty, 0, 0, 0, 0, "Only one <ItemGroup> is expected on this file.", "", ""));
                return(false);
            }
            else
            {
                var filesToSign = itemGroupNode.Descendants("FilesToSign").ToImmutableArray();
                FilesToSign.Add(filesToSign);

                foreach (var file in filesToSign)
                {
                    FakeSignTool.SignFile(file.Attribute("Include").Value);
                }

                return(true);
            }
        }