Enabling create items from templates also without installing it
See original GitHub issueWas thinking, it would enable a lot of ease and usage if the templates can be used without installing it using dotnet new. Can we just use those templates directly from the nugets or a folder to create those items derived from the templates. It may be available now, not sure, but I could not see any available solution for the same.
Audience: dotnet CLI users
Background
Now to instantiate any template you need to install the package containing it first.
The packages are not updated automatically, and it’s user responsibility to keep the up-to-date. To check updates the user needs to use update
command or will be prompted only after outdated template is created.
In many cases, when acquiring new template, it would be beneficial to try it first to see if it matches your needs.
Now it is a 3 step process:
- install the template package
- instantiate the template
- uninstall the template package
Justification
- even better experience for CLI users
- easy option to “try it out” before installing the package
- avoid running outdated templates - always use latest from the source
- popular tools like npx has this experience
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
This would be really useful for enabling
npx
-style usage of templates. Project templates especially you often want to use the latest version on each invocation, and a fire-and-forget experience to run the template without having to do the initial install step can really lower the friction to get started. It also addresses the maintenance aspect of community templates - in the current method you have to update template packages before each invocation if you want to make sure you have the latest.npx
-style invocation would (effectively) do an install, invoke, cleanup process to ensure that you always have the latest versions.@satyajit-behera
do you mean something like this?
> dotnet new my-template --from MyNuGetPack::1.0.0
- runsmy-template
available in MyNuGetPack nuget.org package (version 1.0.0)> dotnet new my-template --from MyFolder
- runsmy-template
from local folderMyFolder