diff options
author | Matt Ward <matt.ward@xamarin.com> | 2017-05-09 16:57:40 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@xamarin.com> | 2017-05-09 16:57:40 +0300 |
commit | 46d9c40486f45ac1d42da59a529928af3f05a41b (patch) | |
tree | 3abdb535c77dc4a3b043a793e492b51b835ab813 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates | |
parent | 0bc0647795681131729a4fb60530420205e7fc48 (diff) |
[Ide] Support different template id and group ids
When using the Microsoft templating engine, used for .NET Core
projects, it is now possible to explicitly specify the template
id and use a different group id. This allows the same project
template to be used in the same category but with a different name
and different grouping. This will be used to add a .NET Core class
library project template next to a .NET Standard project template
in the same category. These are the same underlying project templates
but take different parameters to generate different projects.
In the project template extension there is a new templateId attribute
which can be used to override the default id when looking for the
template in the NuGet package. There is also a groupId attribute
which can override the group id taken from the NuGet package for the
project template.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates')
2 files changed, 4 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineProjectTemplatingProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineProjectTemplatingProvider.cs index ed3434e618..0449b098c8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineProjectTemplatingProvider.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineProjectTemplatingProvider.cs @@ -88,8 +88,8 @@ namespace MonoDevelop.Ide.Templates var newTemplates = new List<MicrosoftTemplateEngineSolutionTemplate> (); foreach (var template in TemplatesNodes) { ITemplateInfo templateInfo; - if (!templateInfos.TryGetValue (template.Id, out templateInfo)) { - LoggingService.LogWarning ("Template {0} not found.", template.Id); + if (!templateInfos.TryGetValue (template.TemplateId, out templateInfo)) { + LoggingService.LogWarning ("Template {0} not found.", template.TemplateId); continue; } newTemplates.Add (new MicrosoftTemplateEngineSolutionTemplate (template, templateInfo)); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs index 063f3de652..6942225ed2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs @@ -37,7 +37,7 @@ namespace MonoDevelop.Ide.Templates //TemplateExtensionNode template; internal MicrosoftTemplateEngineSolutionTemplate (TemplateExtensionNode template, ITemplateInfo templateInfo) - : base (templateInfo.Identity, template.OverrideName ?? templateInfo.Name, template.Icon) + : base (template.Id, template.OverrideName ?? templateInfo.Name, template.Icon) { this.templateInfo = templateInfo; Description = template.OverrideDescription ?? templateInfo.Description; @@ -47,7 +47,7 @@ namespace MonoDevelop.Ide.Templates Language = languageTag.DefaultValue; else Language = string.Empty; - GroupId = templateInfo.GroupIdentity; + GroupId = template.GroupId ?? templateInfo.GroupIdentity; //TODO: Support all this params //Condition = template.Condition; //ProjectFileExtension = template.FileExtension; |