Exemplo n.º 1
0
        ProjectItems GetItemCollection(string fileName)
        {
            string       relPath = ExtendedPath.GetRelativePath(this.projPath, fileName);
            var          dteProj = project.DteProject();
            ProjectItems result  = dteProj.ProjectItems;

            if (relPath.IndexOf(":\\") > -1)
            {
                return(result);
            }
            string[] splittedName = relPath.Split(new char[] { '\\' });
            for (int i = 0; i < splittedName.Length - 1; i++)
            {
                string      name = splittedName[i];
                ProjectItem pi   = result.Item(name);
                if (pi != null)
                {
                    result = pi.ProjectItems;
                }
                else
                {
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        string ProjectName(EnvDTE.Project project)
        {
            string fileName = project.FileName.TrimEnd(Path.DirectorySeparatorChar);

            fileName = ExtendedPath.GetRelativePath(this.solutionDir, fileName);
            return(fileName);
        }
Exemplo n.º 3
0
        public void ToXml(XmlNode parent)
        {
            XmlDocument doc  = (XmlDocument)parent.ParentNode;
            XmlNode     node = doc.CreateElement("ProjectDescription");

            parent.AppendChild(node);
            string reference = this.projPath;

            if (reference.EndsWith("\\"))
            {
                reference = reference.Substring(0, reference.Length - 1);
            }

            MakeNode("BinPath", ExtendedPath.GetRelativePath(reference, binFile), node, doc);
            MakeNode("ObjPath", ExtendedPath.GetRelativePath(reference, objPath), node, doc);
            MakeNode("AssemblyName", assemblyName, node, doc);
            MakeNode("Debug", debug, node, doc);
            MakeNode("IsWebProject", isWebProject, node, doc);
            MakeNode("KeyFile", keyFile, node, doc);
            XmlNode refsNode = MakeNode("References", string.Empty, node, doc);

            foreach (string key in References.Keys)
            {
                NDOReference ndoreference = References[key];
                if (ndoreference.Path == binFile)
                {
                    continue;
                }
                XmlElement refNode = (XmlElement)MakeNode("Reference", "", refsNode, doc);
                refNode.SetAttribute("AssemblyName", ndoreference.Name);
                refNode.SetAttribute("AssemblyPath", ExtendedPath.GetRelativePath(reference, ndoreference.Path));
                if (!ndoreference.CheckThisDLL)
                {
                    refNode.SetAttribute("CheckThisDLL", "False");
                }
            }
        }