Init() public method

Initialize the nested hierarhy node.
This methos should be called just after a NestedProjectNode object is created.
public Init ( string fileName, string destination, string projectName, __VSCREATEPROJFLAGS createFlags ) : void
fileName string The file name of the nested project.
destination string The location of the nested project.
projectName string The name of the project.
createFlags __VSCREATEPROJFLAGS The nested project creation flags
return void
        /// <summary>
        /// This can be called directly or through RunVsTemplateWizard.
        /// This will clone a template project file and add it as a
        /// subproject to our hierarchy.
        /// If you want to create a project for which there exist a
        /// vstemplate, consider using RunVsTemplateWizard instead.
        /// </summary>
        protected internal virtual NestedProjectNode AddNestedProjectFromTemplate(string fileName, string destination, string projectName, ProjectElement element, __VSCREATEPROJFLAGS creationFlags)
        {
            // If this is project creation and the template specified a subproject in its project file, this.nestedProjectElement will be used
            ProjectElement elementToUse = (element == null) ? this.nestedProjectElement : element;

            ThreadHelper.ThrowIfNotOnUIThread();

            if (elementToUse == null)
            {
                // If this is null, this means MSBuild does not know anything about our subproject so add an MSBuild item for it
                elementToUse = new ProjectElement(this, fileName, ProjectFileConstants.SubProject);
            }

            NestedProjectNode node = CreateNestedProjectNode(elementToUse);

            node.Init(fileName, destination, projectName, creationFlags);

            // In case that with did not have an existing element, or the nestedProjectelement was null
            //  and since Init computes the final path, set the MSBuild item to that path
            if (this.nestedProjectElement == null)
            {
                string relativePath = node.Url;
                if (Path.IsPathRooted(relativePath))
                {
                    relativePath = this.ProjectFolder;
                    if (!relativePath.EndsWith("/\\", StringComparison.Ordinal))
                    {
                        relativePath += Path.DirectorySeparatorChar;
                    }

                    relativePath = new Url(relativePath).MakeRelative(new Url(node.Url));
                }

                elementToUse.Rename(relativePath);
            }

            this.AddChild(node);
            return(node);
        }