private VSTemplate GetProjectTemplate(Project project) { var template = new VSTemplate(); template.Type = "Project"; template.Type = "Project"; template.Version = "2.0.0"; template.TemplateData = new VSTemplateTemplateData { Name = new NameDescriptionIcon {Value = project.Name}, ProjectType = "CSharp", Description = new NameDescriptionIcon {Value = ""}, Icon = new NameDescriptionIcon {Value = "__TemplateIcon.ico"}, DefaultName = project.Name, ProvideDefaultName = true, ProvideDefaultNameSpecified = true, SortOrder = "1000", CreateNewFolder = true, CreateNewFolderSpecified = true, }; template.TemplateContent = new VSTemplateTemplateContent(); template.TemplateContent.Items = new[] { new VSTemplateTemplateContentProject { File = _fileSystem.GetFileNameWithExtension( project.FileName), Items = GetItems(project).ToArray(), TargetFileName = _fileSystem.GetFileNameWithExtension( project.FileName), ReplaceParametersSpecified = true, ReplaceParameters = true, } }; template.WizardExtension = CreateWizardExtention(); return template; }
private void WriteTemplateToFile(VSTemplate template, string dir, string projectName) { dir = dir.Combine(GetSolutionParentDir()); string targetDir = Path.Combine(dir, projectName) + "\\"; string filename = Path.Combine(targetDir, projectName + ".vstemplate"); _fileSystem.CreateDirectory(targetDir); template.Serialize(filename); }
private VSTemplate CreateTemplateForSolution(string templateName) { var template = new VSTemplate {TemplateData = new VSTemplateTemplateData()}; template.TemplateData.Name = new NameDescriptionIcon {Value = templateName}; template.TemplateData.Description = new NameDescriptionIcon {Value = ""}; template.TemplateData.ProjectType = "CSharp"; template.TemplateData.ProjectSubType = "My Project Collection"; template.TemplateData.SortOrder = "1"; template.TemplateData.CreateNewFolder = true; template.TemplateData.CreateNewFolderSpecified = true; template.TemplateData.LocationFieldSpecified = true; template.TemplateData.EnableLocationBrowseButton = true; template.TemplateData.EnableLocationBrowseButtonSpecified = true; template.TemplateData.BuildOnLoad = true; template.Type = "ProjectGroup"; template.Version = "2.0.0"; template.TemplateContent = new VSTemplateTemplateContent(); return template; }