/// <summary>
        /// Exports this instance.
        /// </summary>
        public void Export()
        {
            string solutionName = this.Solution.Properties.Item("Name").Value.ToString();

            //Clean or create output directory
            VSTemplateExporterHelper.CreateDirectoryIfNotExists(this.OutputDirectory);

            //Copy solution template icon file
            string outputSolutionTemplateIconFile = Path.Combine(
                this.OutputDirectory,
                Path.GetFileName(this.solutionTemplateIconFile));

            // Check if we need to copy to output or not
            if (!this.solutionTemplateIconFile.Equals(outputSolutionTemplateIconFile,
                                                      StringComparison.InvariantCultureIgnoreCase))
            {
                File.Copy(this.solutionTemplateIconFile, outputSolutionTemplateIconFile, true);
            }

            VSSolutionTemplate vsTemplate = new VSSolutionTemplate();

            vsTemplate.Name        = solutionName;
            vsTemplate.Description = solutionName;
            vsTemplate.DefaultName = solutionName;
            vsTemplate.Icon        = Path.GetFileName(this.SolutionTemplateIconFile);

            XmlNode rootNode              = vsTemplate.CreateRootNode();
            XmlNode templateContentNode   = vsTemplate.CreateTemplateContentNode();
            XmlNode projectCollectionNode = vsTemplate.CreateProjecCollectiontNode();

            foreach (Project project in this.Solution.Projects)
            {
                //Add ProjectTemplateLink and SolutionFolder nodes
                //Create project templates
                AddAssetsToTemplate(project, vsTemplate, projectCollectionNode);
            }

            rootNode.AppendChild(vsTemplate.CreateTemplateDataNode());
            templateContentNode.AppendChild(projectCollectionNode);
            rootNode.AppendChild(templateContentNode);
            rootNode.AppendChild(vsTemplate.CreateWizardExtensionNode());
            rootNode.AppendChild(vsTemplate.CreateWizardDataNode());

            //Save solution template
            vsTemplate.Save(
                this.OutputDirectory,
                string.Concat(solutionName, VSTemplateExporterHelper.TEMPLATE_EXTENSION));
        }