Skip to content

Commit 70ad900

Browse files
Further update dotnet new template builder to produce correct template.son contents
1 parent fadc5d7 commit 70ad900

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

templates/package-builder/src/build/build.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,10 @@ function buildDotNetNewNuGetPackage() {
128128
const sourceProjectName = 'WebApplicationBasic';
129129
const projectGuid = '00000000-0000-0000-0000-000000000000';
130130
const filenameReplacements = [
131-
// TODO: For dotnetnew templates, switch to csproj. No need for SDK choice as it can be Preview3+ only.
132-
{ from: /.*\.xproj$/, to: `${sourceProjectName}.xproj` },
131+
{ from: /.*\.csproj$/, to: `${sourceProjectName}.csproj` },
133132
{ from: /\btemplate_gitignore$/, to: '.gitignore' }
134133
];
135-
const contentReplacements = [
136-
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: `<ProjectGuid>${projectGuid}</ProjectGuid>` },
137-
{ from: /<RootNamespace>.*?<\/RootNamespace>/g, to: `<RootNamespace>${sourceProjectName}</RootNamespace>`},
138-
{ from: /\s*<BaseIntermediateOutputPath.*?<\/BaseIntermediateOutputPath>/g, to: '' },
139-
{ from: /\s*<OutputPath.*?<\/OutputPath>/g, to: '' },
140-
];
134+
const contentReplacements = [];
141135
_.forEach(templates, (templateConfig, templateName) => {
142136
const templateOutputDir = path.join(outputRoot, 'Content', templateName);
143137
writeTemplate(templateConfig.dir, templateOutputDir, contentReplacements, filenameReplacements, templateConfig.forceInclusion);
@@ -148,14 +142,15 @@ function buildDotNetNewNuGetPackage() {
148142

149143
fs.writeFileSync(path.join(templateConfigDir, 'template.json'), JSON.stringify({
150144
author: 'Microsoft',
151-
classifications: [ 'Standard>>Quick Starts' ],
152-
name: `ASP.NET Core SPA with ${templateConfig.displayName}`,
153-
groupIdentity: `Microsoft.AspNetCore.Spa.${templateConfig.dotNetNewId}`,
154-
identity: `Microsoft.AspNetCore.Spa.${templateConfig.dotNetNewId}`,
155-
shortName: `aspnetcorespa-${templateConfig.dotNetNewId.toLowerCase()}`,
156-
tags: { language: 'C#' },
157-
guids: [ projectGuid ],
158-
sourceName: sourceProjectName
145+
classifications: ["Web", "MVC", "SPA"],
146+
name: `MVC ASP.NET Core with ${templateConfig.displayName}`,
147+
groupIdentity: `Microsoft.AspNetCore.SpaTemplates.${templateConfig.dotNetNewId}`,
148+
identity: `Microsoft.AspNetCore.SpaTemplates.${templateConfig.dotNetNewId}.CSharp`,
149+
shortName: `${templateConfig.dotNetNewId.toLowerCase()}`,
150+
tags: { language: 'C#', type: 'project' },
151+
sourceName: sourceProjectName,
152+
preferNameDirectory: true,
153+
symbols: {}
159154
}, null, 2));
160155

161156
fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({

templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.Spa.Templates.nuspec renamed to templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
4-
<id>Microsoft.AspNetCore.Spa.Templates</id>
4+
<id>Microsoft.AspNetCore.SpaTemplates</id>
55
<version>{version}</version>
66
<description>Single Page Application templates for ASP.NET Core</description>
77
<authors>Microsoft</authors>

0 commit comments

Comments
 (0)