コード例 #1
0
 private static void ParseProjectReferences(XDocument projectFileDoc, XNamespace @namespace, ProjectFile projectFile)
 {
     foreach (var referenceNode in projectFileDoc.Descendants(@namespace + "ProjectReference"))
     {
         projectFile.AddProjectReference(new ProjectReference(referenceNode.Attribute("Include").Value));
     }
 }
コード例 #2
0
        public void WriteToFile(ProjectFile projectFile)
        {
            if (_writer == null)
                _writer = File.CreateText(_fileName);

            _writer.WriteLine("----------------------------------------------------");
            _writer.WriteLine("Project: " + projectFile.FileName);

            WriteBuildOutputDirectorySection(projectFile);
            WriteProjectReferencesSection(projectFile);
        }
コード例 #3
0
        private ProjectFile ProcessFile(string file)
        {
            var projectFile = new ProjectFile(file);

            var projectFileDoc = XDocument.Load(file);
            XNamespace @namespace = "";
            if (projectFileDoc.Root != null)
                @namespace = projectFileDoc.Root.Name.Namespace;

            ParseBuildDirectory(projectFileDoc, @namespace, projectFile);
            ParseProjectReferences(projectFileDoc, @namespace, projectFile);

            return projectFile;
        }
コード例 #4
0
        private void ParseBuildDirectory(XDocument projectFileDoc, XNamespace @namespace, ProjectFile projectFile)
        {
            var node = (from g in projectFileDoc.Descendants(@namespace + "PropertyGroup")
                        let config = g.Attribute("Condition")
                        where
                            config != null &&
                            config.Value.ToLowerInvariant() ==
                            " '$(configuration)|$(platform)' == '" + _buildConfiguration + "|" + _buildPlatform + "' "
                        select g.Element(@namespace + "OutputPath")).FirstOrDefault();

            if (node != null)
            {
                projectFile.SetBuildOutputDirectory(node.Value);
            }
        }
コード例 #5
0
 private void WriteProjectReferencesSection(ProjectFile projectFile)
 {
     _writer.Write("\tProject References: ");
     if (projectFile.ProjectReferences.Any())
     {
         _writer.WriteLine("");
         foreach (var reference in projectFile.ProjectReferences)
         {
             _writer.WriteLine("\t\t" + reference.ReferencedProjectFile);
         }
     }
     else
     {
         _writer.WriteLine("None Found");
     }
 }
コード例 #6
0
 private void WriteBuildOutputDirectorySection(ProjectFile projectFile)
 {
     _writer.WriteLine("\tBuild Output (relative): " + projectFile.BuildOutputDirectoryRelative);
     _writer.WriteLine("\tBuild Output (absolute): " + projectFile.BuildOutputDirectoryAbsolute);
 }