/// <summary>
        /// Links a nested project as a virtual project to the solution.
        /// </summary>
        protected internal virtual void AddVirtualProject()
        {
            // This is the second step in creating and adding a nested project. The inner hierarchy must have been
            // already initialized at this point.
            #region precondition
            if (this.nestedHierarchy == null)
            {
                throw new InvalidOperationException();
            }
            #endregion
            // get the IVsSolution interface from the global service provider
            IVsSolution solution = this.GetService(typeof(IVsSolution)) as IVsSolution;
            Debug.Assert(solution != null, "Could not get the IVsSolution object from the services exposed by this project");
            if (solution == null)
            {
                throw new InvalidOperationException();
            }

            this.InitializeInstanceGuid();

            // Add virtual project to solution.
            ErrorHandler.ThrowOnFailure(solution.AddVirtualProjectEx(this.nestedHierarchy, this.VirtualProjectFlags, ref this.projectInstanceGuid));

            // Now set up to listen on file changes on the nested project node.
            this.ObserveNestedProjectFile();
        }
Example #2
0
 public int AddVirtualProjectEx(IVsHierarchy pHierarchy, uint grfAddVPFlags, ref Guid rguidProjectID)
 {
     return(_solution.AddVirtualProjectEx(pHierarchy, grfAddVPFlags, ref rguidProjectID));
 }