public 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();
}