Skip to content

This repo contains the Template Engine which is used by dotnet new

License

Notifications You must be signed in to change notification settings

milanjaros/templating

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Overview

This repository is the home for the .NET Core Template Engine. It contains the brains for dotnet new and template instantiation in Visual Studio. When dotnet new is invoked, it will call the Template Engine to create the artifacts on disk. Template Engine is a library for manipulating streams, including operations to replace values, include/exclude regions and process if, else if, else and end if style statements.

Template Content Repositories

.NET default templates are located in several repositories.

The templates are located in the following repositories:

Templates Repository
Common project and item templates dotnet/sdk
ASP.NET and Blazor templates dotnet/aspnetcore
ASP.NET Single Page Application templates dotnet/spa-templates
WPF templates dotnet/wpf
Windows Forms templates dotnet/winforms
Test templates dotnet/test-templates
MAUI templates dotnet/maui

Issues for the template content should be opened in the corresponding repository.

Template Samples

We have created a dotnet template samples repo, which shows how you can use the Template Engine to create new templates. The samples are setup to be stand alone for specific examples.

dotnet new

dotnet new CLI is now located in dotnet/sdk repo.

You can create new projects with dotnet new, this section will briefly describe that. For more info take a look at Announcing .NET Core Tools Updates in VS 2017 RC.

To get started let's find out what options we have by executing dotnet new --help. The result is pasted in the block below.

$ dotnet new mvc --help

MVC ASP.NET Web Application (C#)
Author: Microsoft
Options:
  -au|--auth           The type of authentication to use
                           None          - No authentication
                           Individual    - Individual authentication
                       Default: None

  -uld|--use-local-db  Whether or not to use LocalDB instead of SQLite
                       bool - Optional
                       Default: false

  -f|--framework
                           1.0    - Target netcoreapp1.0
                           1.1    - Target netcoreapp1.1
                       Default: 1.0

Let's create a new project named "MyAwesomeProject" in the "src/MyProject" directory. This project should be an ASP.NET MVC project with Individual Auth. To create that template execute dotnet new mvc -n MyAwesomeProject -o src/MyProject -au Individual. Let's try that now, the result is below.

$ dotnet new mvc -n MyAwesomeProject -o src/MyProject -au Individual
The template "MVC Application" created successfully.

The project was successfully created on disk as expected in src/MyProject. From here, we can run normal dotnet commands like dotnet restore and dotnet build.

We have a pretty good help system built in, including template specific help (for example dotnet new mvc --help). If you're not sure the syntax please try that, if you have any difficulties please file a new issue.

Now that we've covered the basics of using dotnew new, lets move on to info for template authors and contributors.

Available templates

You can install additional templates that can be used by dotnet new. To search for the templates available on NuGet.org, use dotnet new --search.

    dotnet new --search web
    dotnet new --search azure --type project
    dotnet new --search azure --author Microsoft

What to expect when working with this repo

This repo only contains libraries and packages that are used by dotnet new and Visual Studio to instantiate the template. There is no UI for this libraries. To build, run and debug dotnet new, see the instuctions in dotnet/sdk repo.

How to build, run & debug

Check out our contributing page to learn how you can build, run and debug.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

About

This repo contains the Template Engine which is used by dotnet new

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 91.9%
  • PowerShell 4.5%
  • Shell 3.0%
  • CMake 0.4%
  • HTML 0.1%
  • CSS 0.1%