/// <summary>
        /// Constructor for the ReferenceNode. It is called when the project is reloaded, when the project element representing the refernce exists. 
        /// </summary>
        internal ProjectReferenceNode(ProjectNode root, ProjectElement element)
            : base(root, element)
        {
            this.referencedProjectRelativePath = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
            Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectRelativePath), "Could not retrive referenced project path form project file");

            string guidString = this.ItemNode.GetMetadata(ProjectFileConstants.Project);

            // Continue even if project setttings cannot be read.
            try
            {
                this.referencedProjectGuid = new Guid(guidString);

                this.buildDependency = new BuildDependency(this.ProjectMgr, this.referencedProjectGuid);
                this.ProjectMgr.AddBuildDependency(this.buildDependency);
            }
            finally
            {
                Debug.Assert(this.referencedProjectGuid != Guid.Empty, "Could not retrive referenced project guidproject file");

                this.referencedProjectName = this.ItemNode.GetMetadata(ProjectFileConstants.Name);

                Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectName), "Could not retrive referenced project name form project file");
            }

            Uri uri = new Uri(this.ProjectMgr.BaseURI.Uri, this.referencedProjectRelativePath);

            if (uri != null)
            {
                this.referencedProjectFullPath = Microsoft.VisualStudio.Shell.Url.Unescape(uri.LocalPath, true);
            }
        }
Example #2
0
        /// <summary>
        /// Overloaded constructor for creating a ComReferenceNode from selector data
        /// </summary>
        /// <param name="root">The Project node</param>
        /// <param name="selectorData">The component selctor data.</param>
        internal ComReferenceNode(ProjectNode root, VSCOMPONENTSELECTORDATA selectorData)
            : base(root)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }
            if (selectorData.type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project
                || selectorData.type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus)
            {
                throw new ArgumentException();
            }

            // Initialize private state
            this.typeName = selectorData.bstrTitle;
            this.typeGuid = selectorData.guidTypeLibrary;
            this.majorVersionNumber = selectorData.wTypeLibraryMajorVersion.ToString(CultureInfo.InvariantCulture);
            this.minorVersionNumber = selectorData.wTypeLibraryMinorVersion.ToString(CultureInfo.InvariantCulture);
            this.lcid = (int) selectorData.lcidTypeLibrary;

            // Check to see if the COM object actually exists.
            this.SetInstalledFilePath();
            // If the value cannot be set throw.
            if (String.IsNullOrEmpty(this.installedFilePath))
            {
                var message = string.Format(SR.GetString(SR.ReferenceCouldNotBeAdded, CultureInfo.CurrentUICulture), selectorData.bstrTitle);
                throw new InvalidOperationException(message);
            }
        }
 public GroupingReferenceNode(ProjectNode project, string name, string identity, string resolutionPath, string version, string[] groupedItems) 
     : base(project)
 {
     Name = name;
     Identity = identity;
     ResolutionPath = resolutionPath;
     Version = version;
     GroupedItems = groupedItems;
 }
Example #4
0
        /// <summary>
        /// Constructor for IVSOutput2 implementation
        /// </summary>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="outputAssembly">MSBuild generated item corresponding to the output assembly (by default, these would be of type MainAssembly</param>
        public Output(ProjectNode projectManager, Microsoft.Build.Execution.ProjectItemInstance outputAssembly)
        {
            if (projectManager == null)
                throw new ArgumentNullException("projectManager");
            if (outputAssembly == null)
                throw new ArgumentNullException("outputAssembly");

            project = projectManager;
            output = outputAssembly;
        }
Example #5
0
        internal OAProject(ProjectNode project)
        {
            this.project = project;

            #if UNUSED_NESTED_PROJECTS
            if (project is ProjectContainerNode)
            {
                this.solutionFolder = new Automation.OASolutionFolder<ProjectContainerNode>((ProjectContainerNode)project);
            }
            #endif
        }
 /// <summary>
 /// Creating AssemblyReferenceNode via VS UI ("Add Reference" or otherwise)
 /// </summary>
 private AssemblyReferenceNode(ProjectNode root, string assemblyFullPath, AddReferenceDialogTab tab)
     : base(root)
 {
     // Validate the input parameters.
     if (null == root)
     {
         throw new ArgumentNullException("root");
     }
     if (string.IsNullOrEmpty(assemblyFullPath))
     {
         throw new ArgumentNullException("assemblyFullPath");
     }
     ResolveAssemblyReferenceByFullPath(assemblyFullPath, tab);
     this.InitializeFileChangeEvents();
 }
Example #7
0
        /// <summary>
        /// Constructor for IVSOutputGroup2 implementation
        /// </summary>
        /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
        /// <param name="msBuildTargetName">MSBuild target name</param>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        internal OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
        {
            if (outputName == null)
                throw new ArgumentNullException("outputName");
            if (msBuildTargetName == null)
                throw new ArgumentNullException("outputName");
            if (projectManager == null)
                throw new ArgumentNullException("projectManager");
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            name = outputName;
            targetName = msBuildTargetName;
            project = projectManager;
            projectCfg = configuration;
        }
Example #8
0
        /// <summary>
        /// Constructor for the ComReferenceNode. 
        /// </summary>
        internal ComReferenceNode(ProjectNode root, ProjectElement element)
            : base(root, element)
        {
            this.typeName = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
            string typeGuidAsString = this.ItemNode.GetMetadata(ProjectFileConstants.Guid);
            if (typeGuidAsString != null)
            {
                this.typeGuid = new Guid(typeGuidAsString);
            }

            this.majorVersionNumber = this.ItemNode.GetMetadata(ProjectFileConstants.VersionMajor);
            this.minorVersionNumber = this.ItemNode.GetMetadata(ProjectFileConstants.VersionMinor);
            this.lcid = int.Parse(this.ItemNode.GetMetadata(ProjectFileConstants.Lcid));
            this.SetProjectItemsThatRelyOnReferencesToBeResolved(false);
            this.SetInstalledFilePath();
        }
Example #9
0
        internal ProjectConfig(ProjectNode project, ConfigCanonicalName configName)
        {
            this.project = project;
            this.configCanonicalName = configName;
            this.fCanLaunchCache = -1;
            this.lastCache = DateTime.MinValue;
            this.projectConfigurationProperties = new ProjectConfigProperties(this);

            ErrorHandler.ThrowOnFailure(ProjectMgr.InteropSafeIVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(this, out flavoredCfg));

            // if the flavored object support XML fragment, initialize it
            IPersistXMLFragment persistXML = flavoredCfg as IPersistXMLFragment;
            if (null != persistXML)
            {
                this.project.LoadXmlFragment(persistXML, this.DisplayName);
            }
        }
        /// <summary>
        /// Creating AssemblyReferenceNode via automation (Cider case)
        /// </summary>
        private AssemblyReferenceNode(int dummy, ProjectNode root, string assemblyName)
            : base(root)
        {
            // Validate the input parameters.
            if (null == root)
            {
                throw new ArgumentNullException("root");
            }
            if (string.IsNullOrEmpty(assemblyName))
            {
                throw new ArgumentNullException("assemblyName");
            }
            AddToProjectFileAndTryResolve(assemblyName);
            InitializeAssemblyName(assemblyName);

            if (!this.resolvedInfo.WasSuccessfullyResolved)
            {
                this.ProjectMgr.AddReferenceCouldNotBeAddedErrorMessage(assemblyName);
            }

            if (!resolvedInfo.IsPlatformAssembly)
            {
                this.msbuildProjectionInfo.WantFusionName = true;
            }

            this.InitializeFileChangeEvents();
        }
Example #11
0
 internal ReferenceNode(ProjectNode root)
     : base(root)
 {
     this.ExcludeNodeFromScc = true;
 }
 public TrackDocumentsHelper(ProjectNode project)
 {
     this.projectMgr = project;
 }
 public ProjectDesignerDocumentManager(ProjectNode node)
     : base(node)
 {
 }
Example #14
0
 internal static AssemblyReferenceNode CreateFromAssemblyNameViaUIAutomation(ProjectNode root, string assemblyName)
 {
     return(new AssemblyReferenceNode(0, root, assemblyName));
 }
Example #15
0
 public BuildDependency(ProjectNode projectMgr, Guid projectReference)
 {
     this.referencedProjectGuid = projectReference;
     this.projectMgr            = projectMgr;
 }
 internal ReferenceContainerNode(ProjectNode root) : base(root)
 {
     this.VirtualNodeName    = ReferencesNodeVirtualName;
     this.ExcludeNodeFromScc = true;
 }
 internal ConfigProvider(ProjectNode manager)
 {
     this.project = manager;
 }
Example #18
0
 public TrackDocumentsHelper(ProjectNode project)
 {
     this.projectMgr = project;
 }
Example #19
0
        internal static BuildResult BuildInstance(ProjectNode projectNode, ref ProjectInstance instance, string target)
        {
            var submission = projectNode.DoMSBuildSubmission(BuildKind.SYNC, target, ref instance, null);

            return(new BuildResult(submission, instance));
        }
Example #20
0
 /// <summary>
 /// Creating AssemblyReferenceNode from fsproj element
 /// </summary>
 private AssemblyReferenceNode(ProjectNode root, ProjectElement element, BuildResult buildResult)
     : base(root, element)
 {
     BindFromBuildResult(element.Item, buildResult);
 }
Example #21
0
 public ProjectDesignerDocumentManager(ProjectNode node)
     : base(node)
 {
 }
Example #22
0
 internal static AssemblyReferenceNode CreateFromProjectFile(ProjectNode root, ProjectElement element, BuildResult buildResult)
 {
     return(new AssemblyReferenceNode(root, element, buildResult));
 }
Example #23
0
        // Create a ComReferenceNode via a string to a TLB
        internal ComReferenceNode(ProjectNode root, string filePath)
            : base(root)
        {
            object otypeLib = null;
            ComTypes.ITypeLib typeLib = null;
            IntPtr ptrToLibAttr = IntPtr.Zero;
            try
            {
                LoadTypeLibEx( filePath, RegKind.RegKind_None, out otypeLib );
                typeLib = (ComTypes.ITypeLib)otypeLib;
                if (typeLib == null)
                {
                    throw new ArgumentException();
                }
                ComTypes.TYPELIBATTR typeAttr = new ComTypes.TYPELIBATTR();
                typeLib.GetLibAttr(out ptrToLibAttr);
                typeAttr = (ComTypes.TYPELIBATTR)Marshal.PtrToStructure(ptrToLibAttr, typeAttr.GetType());

                // Initialize state
                this.typeGuid = typeAttr.guid;
                this.majorVersionNumber = typeAttr.wMajorVerNum.ToString(CultureInfo.InvariantCulture);
                this.minorVersionNumber = typeAttr.wMinorVerNum.ToString(CultureInfo.InvariantCulture);
                this.lcid = typeAttr.lcid;

                // Check to see if the COM object actually exists.
                this.SetInstalledFilePath();
                // If the value cannot be set throw.
                if (String.IsNullOrEmpty(this.installedFilePath))
                {
                    var message = string.Format(SR.GetString(SR.ReferenceCouldNotBeAdded, CultureInfo.CurrentUICulture), filePath);
                    throw new InvalidOperationException(message);
                }
            }
            finally
            {
                if (typeLib != null) typeLib.ReleaseTLibAttr(ptrToLibAttr);
            }
        }
Example #24
0
 internal ProjectNodeProperties(ProjectNode node)
     : base(node)
 {
 }
Example #25
0
 /// <summary>
 /// Constructor for the FolderNode
 /// </summary>
 /// <param name="root">Root node of the hierarchy</param>
 /// <param name="relativePath">relative path from root i.e.: "NewFolder1\\NewFolder2\\NewFolder3</param>
 /// <param name="element">Associated project element</param>
 internal FolderNode(ProjectNode root, string relativePath, ProjectElement element)
     : base(root, element)
 {
     this.VirtualNodeName = relativePath.TrimEnd('\\');
 }
Example #26
0
 internal static AssemblyReferenceNode CreateFromFullPathViaUIAddReference(ProjectNode root, string assemblyFullPath, AddReferenceDialogTab tab)
 {
     return(new AssemblyReferenceNode(root, assemblyFullPath, tab));
 }
Example #27
0
 /// <summary>
 /// Constructor for the DependentFileNode
 /// </summary>
 /// <param name="root">Root of the hierarchy</param>
 /// <param name="e">Associated project element</param>
 internal DependentFileNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.HasParentNodeNameRelation = false;
 }
 internal ReferenceContainerNode(ProjectNode root) : base(root)
 {
     this.VirtualNodeName = ReferencesNodeVirtualName;
     this.ExcludeNodeFromScc = true;
 }
 /// <summary>
 /// Constructor for the LinkedFileNode
 /// </summary>
 /// <param name="root">Root of the hierarchy</param>
 /// <param name="e">Associated project element</param>
 /// <param name="hierarchyId">Optional hierarchy id - used during rename</param>
 internal LinkedFileNode(ProjectNode root, ProjectElement e, uint? hierarchyId = null)
     : base(root, e, hierarchyId)
 {
     this._linkFile = false;
 }
 internal static AssemblyReferenceNode CreateFromProjectFile(ProjectNode root, ProjectElement element, BuildResult buildResult)
 { return new AssemblyReferenceNode(root, element, buildResult); }
Example #31
0
 public BuildDependency(ProjectNode projectMgr, Guid projectReference)
 {
     this.referencedProjectGuid = projectReference;
     this.projectMgr = projectMgr;
 }
 internal static AssemblyReferenceNode CreateFromAssemblyNameViaUIAutomation(ProjectNode root, string assemblyName)
 { return new AssemblyReferenceNode(0, root, assemblyName); }
Example #33
0
 public /*protected, but public for FSharp.Project.dll*/ virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group)
 {
     OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);
     return outputGroup;
 }
        /// <summary>
        /// Returns target framework for the given project node
        /// </summary>
        /// <param name="projectNode"></param>
        /// <returns></returns>
        private static System.Runtime.Versioning.FrameworkName GetProjectTargetFrameworkName(ProjectNode projectNode)
        {
            string targetFrameworkMoniker = projectNode.GetTargetFrameworkMoniker();

            return(new System.Runtime.Versioning.FrameworkName(targetFrameworkMoniker));
        }
 internal ReferenceNode(ProjectNode root)
     : base(root)
 {
     this.ExcludeNodeFromScc = true;
 }
Example #36
0
        /// <summary>
        /// Constructor to create a new MSBuild.BuildItem and add it to the project
        /// Only have public constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        public ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (String.IsNullOrEmpty(itemPath))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemPath");
            }


            if (String.IsNullOrEmpty(itemType))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemType");
            }

            this.itemProject = project;

            // create and add the item to the project
            DoAdd(itemType, itemPath);
            CheckAndTryToFixWildcards(itemType, itemPath);

            this.itemProject.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
 internal static AssemblyReferenceNode CreateFromFullPathViaUIAddReference(ProjectNode root, string assemblyFullPath, AddReferenceDialogTab tab)
 { return new AssemblyReferenceNode(root, assemblyFullPath, tab); }
Example #38
0
        /// <summary>
        /// Constructor to Wrap an existing MSBuild.BuildItem
        /// Only have public constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        /// <param name="project">Project that owns this item</param>
        /// <param name="existingItem">an MSBuild.BuildItem; can be null if virtualFolder is true</param>
        /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
        public ProjectElement(ProjectNode project, Microsoft.Build.Evaluation.ProjectItem existingItem, bool virtualFolder)
        {
            if (project == null)
                throw new ArgumentNullException("project");
            if (!virtualFolder && existingItem == null)
                throw new ArgumentNullException("existingItem");

            // Keep a reference to project and item
            this.itemProject = project;
            this.item = existingItem;
            this.isVirtual = virtualFolder;

            if (this.isVirtual)
                this.virtualProperties = new Dictionary<string, string>();
        }
 /// <summary>
 /// Creating AssemblyReferenceNode from fsproj element
 /// </summary>
 private AssemblyReferenceNode(ProjectNode root, ProjectElement element, BuildResult buildResult)
     : base(root, element)
 {
     BindFromBuildResult(element.Item, buildResult);
 }
Example #40
0
 /// <summary>
 /// Calling this method remove this item from the project file.
 /// Once the item is delete, you should not longer be using it.
 /// Note that the item should be removed from the hierarchy prior to this call.
 /// </summary>
 public void RemoveFromProjectFile()
 {
     if (!deleted && item != null)
     {
         deleted = true;
         itemProject.BuildProject.RemoveItem(item);
         itemProject.SetProjectFileDirty(true);
     }
     itemProject = null;
     item = null;
 }
 internal static BuildResult BuildInstance(ProjectNode projectNode, ref ProjectInstance instance, string target)
 {
     var submission = projectNode.DoMSBuildSubmission(BuildKind.SYNC, target, ref instance, null);
     return new BuildResult(submission, instance);
 }
Example #42
0
 /// <summary>
 /// Overloadde ctor.
 /// </summary>
 /// <param name="ProjectNode">The associated project</param>
 /*internal, but public for FSharp.Project.dll*/
 public SingleFileGenerator(ProjectNode projectMgr)
 {
     this.projectMgr = projectMgr;
 }
Example #43
0
 public virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group)
 {
     OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);
     return outputGroup;
 }
Example #44
0
 /// <summary>
 /// Constructor for the LinkedFileNode
 /// </summary>
 /// <param name="root">Root of the hierarchy</param>
 /// <param name="e">Associated project element</param>
 /// <param name="hierarchyId">Optional hierarchy id - used during rename</param>
 internal LinkedFileNode(ProjectNode root, ProjectElement e, uint?hierarchyId = null)
     : base(root, e, hierarchyId)
 {
     this._linkFile = false;
 }