From 4dbafd4e8519ea5cdc0113b00f5931afa68adb08 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Wed, 22 Mar 2017 15:14:14 -0700 Subject: [PATCH] Fix #454 by demanding that --name be specified if no non-empty name can be determined --- .../Template/TemplateCreator.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Microsoft.TemplateEngine.Edge/Template/TemplateCreator.cs b/src/Microsoft.TemplateEngine.Edge/Template/TemplateCreator.cs index 15c59e5c10c..521e45e1b17 100644 --- a/src/Microsoft.TemplateEngine.Edge/Template/TemplateCreator.cs +++ b/src/Microsoft.TemplateEngine.Edge/Template/TemplateCreator.cs @@ -31,6 +31,12 @@ public async Task InstantiateAsync(ITemplateInfo templat } string realName = name ?? template.DefaultName ?? fallbackName; + + if(string.IsNullOrEmpty(realName)) + { + return new TemplateCreationResult("--name", CreationResultStatus.InvalidParamValues, template.Name); + } + // there should never be param errors here. If there are, the template is malformed, or the host gave an invalid value. IParameterSet templateParams = SetupDefaultParamValuesFromTemplateAndHost(template, realName, out IList defaultParamsWithInvalidValues); if (defaultParamsWithInvalidValues.Any())