Microsoft.VisualStudio.Project.ProjectFactory.CreateProject C# (CSharp) Method

CreateProject() protected method

Rather than directly creating the project, ask VS to initate the process of creating an aggregated project in case we are flavored. We will be called on the IVsAggregatableProjectFactory to do the real project creation.
protected CreateProject ( string fileName, string location, string name, uint flags, System.Guid &projectGuid, IntPtr &project, int &canceled ) : void
fileName string Project file
location string Path of the project
name string Project Name
flags uint Creation flags
projectGuid System.Guid Guid of the project
project System.IntPtr Project that end up being created by this method
canceled int Was the project creation canceled
return void
        protected override void CreateProject(string fileName, string location, string name, uint flags, ref Guid projectGuid, out IntPtr project, out int canceled)
        {
            project = IntPtr.Zero;
            canceled = 0;

            // Get the list of GUIDs from the project/template
            string guidsList = this.ProjectTypeGuids(fileName);

            // Launch the aggregate creation process (we should be called back on our IVsAggregatableProjectFactoryCorrected implementation)
            IVsCreateAggregateProject aggregateProjectFactory = (IVsCreateAggregateProject)this.Site.GetService(typeof(SVsCreateAggregateProject));
            int hr = aggregateProjectFactory.CreateAggregateProject(guidsList, fileName, location, name, flags, ref projectGuid, out project);
            if(hr == VSConstants.E_ABORT)
                canceled = 1;
            ErrorHandler.ThrowOnFailure(hr);

            // This needs to be done after the aggregation is completed (to avoid creating a non-aggregated CCW) and as a result we have to go through the interface
            IProjectEventsProvider eventsProvider = (IProjectEventsProvider)Marshal.GetTypedObjectForIUnknown(project, typeof(IProjectEventsProvider));
            eventsProvider.ProjectEventsProvider = this.GetProjectEventsProvider();

            this.buildProject = null;
        }

Same methods

ProjectFactory::CreateProject ( ) : ProjectNode