Visual Studio Notes
1. Using the Project Template Export Wizard
-
The
Project Template Export Wizardwill export your current project as a template. -
This is a starting point for creating a template. Once exported, the template will require customization by manually adding
Template parameters.
1.1. Create a project that you’d like to be templated.
-
Create a project including all required files and library references.
Nothing special is required in order to template this project. Customization will occur later…
1.2. Export the template
-
Official documentation.
-
Choose the following:
-
Choose the Project template radio button.
-
Select the project.
-
Click Next
-
Provide values for:
-
Template Name
XS-BlazorApp -
Template Description]
A project template for creating a Blazor Server app preconfigured to use the XS Component Library. -
Template Icon image
C:\Users\mattosd\source\repos\GitLab\repo-dot-net-core\Com.XS.Spa.Accounting\Com.XS.Spa.Accounting\wwwroot\android-chrome-192x192.png
-
-
Click the Finish button.
-
2. Customize the Template
-
Unzip the previously exported template file.
-
Delete the zipped file.
-
Make changes to the
_Imports.razorfile.-
Find these lines
@using Template_BlazorApp_Net_7._0 @using Template_BlazorApp_Net_7._0.Shared
-
And replace the project name with a project name variable as follows:
@using $safeprojectname$ @using $safeprojectname$.Shared
-
-
Make changes to the MyTemplate.vstemplate file.
-
Find the line for the
_Imports.razorfile.<ProjectItem ReplaceParameters="false" TargetFileName="_Imports.razor">_Imports.razor</ProjectItem>
-
Flip the
ReplaceParametersvalue totrue.ReplaceParameters="true"
-
-
After making changes, copy the unzipped folder to the project template cache folder overwritting the existing folder:
Project Template Cache location%appdata%\Microsoft\VisualStudio\17.0_632eabc8\ProjectTemplatesCacheThe actual folder may be slightly different.