Skip to content

Commit b9e62cd

Browse files
Fix "dotnet new" postAction issues (and disable the "npm install" action)
1 parent ad9cfbb commit b9e62cd

File tree

1 file changed

+34
-15
lines changed
  • templates/package-builder/src/build

1 file changed

+34
-15
lines changed

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

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,27 +164,46 @@ function buildDotNetNewNuGetPackage() {
164164
}
165165
],
166166
defaultValue: 'netcoreapp1.1'
167+
},
168+
skipRestore: {
169+
type: 'parameter',
170+
datatype: 'bool',
171+
description: 'If specified, skips the automatic restore of packages on project creation.',
172+
defaultValue: 'false'
167173
}
168174
},
169175
tags: { language: 'C#', type: 'project' },
170-
postActions: [{
171-
condition: '(!skipRestore)',
172-
description: 'Restores NuGet packages required by this project.',
173-
manualInstructions: [{ text: 'Run \'dotnet restore\'' }],
174-
actionId: '210D431B-A78B-4D2F-B762-4ED3E3EA9025',
175-
continueOnError: true
176-
}, {
177-
condition: '(!skipRestore)',
178-
description: 'Restores NPM packages required by this project.',
179-
manualInstructions: [{ text: 'Run \'npm install\'' }],
180-
actionId: '3A7C4B45-1F5D-4A30-959A-51B88E82B5D2',
181-
args: { executable: 'npm', args: 'install' },
182-
continueOnError: false
183-
}],
176+
postActions: [
177+
{
178+
condition: '(!skipRestore)',
179+
description: 'Restores NuGet packages required by this project.',
180+
manualInstructions: [{ text: 'Run \'dotnet restore\'' }],
181+
actionId: '210D431B-A78B-4D2F-B762-4ED3E3EA9025',
182+
continueOnError: true
183+
},
184+
/*
185+
// Currently it doesn't appear to be possible to run `npm install` from a
186+
// postAction, due to https://github.com/dotnet/templating/issues/849
187+
// We will re-enable this when that bug is fixed.
188+
{
189+
condition: '(!skipRestore)',
190+
description: 'Restores NPM packages required by this project.',
191+
manualInstructions: [{ text: 'Run \'npm install\'' }],
192+
actionId: '3A7C4B45-1F5D-4A30-959A-51B88E82B5D2',
193+
args: { executable: 'npm', args: 'install' },
194+
continueOnError: false
195+
}
196+
*/
197+
],
184198
}, null, 2));
185199

186200
fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({
187-
symbolInfo: {}
201+
symbolInfo: {
202+
skipRestore: {
203+
longName: 'no-restore',
204+
shortName: ''
205+
}
206+
}
188207
}, null, 2));
189208

190209
fs.writeFileSync(path.join(templateConfigDir, 'vs-2017.3.host.json'), JSON.stringify({

0 commit comments

Comments
 (0)