GithubHelp home page GithubHelp logo

isabella232 / templating-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dotnet/templating

0.0 0.0 0.0 24.72 MB

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

Home Page: https://docs.microsoft.com/dotnet/

License: MIT License

PowerShell 4.03% Batchfile 0.02% Shell 2.44% C# 93.14% CSS 0.01% F# 0.07% Smalltalk 0.01% CMake 0.24% Visual Basic .NET 0.03% GLSL 0.01% Dockerfile 0.01%

templating-2's Introduction

Build Status

Overview

This repository is the home for the .NET Core Template Engine. It contains the brains for dotnet new. 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. This repository only contains the following templates:

  • Console Application (console)
  • Class Library (classlib)
  • Common item templates (gitignore, globaljson, nugetconfig, sln, etc.)

Other templates are located in the following repositories:

Templates Repository
ASP.NET and Blazor templates dotnet/aspnetcore
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.

Info for dotnet new users

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. See Available templates for dotnet new.

What to expect when working with this repo

The instructions below enable a new command at the dotnet CLI, dotnet new3, that uses the bits and templates contained in this repo. Think of it as a "preview" version of dotnet new for trying out new switches, interactions and display styles before rolling them in to the product.

Commands executed against dotnet new3 won't impact the behavior of dotnet new, Visual Studio for Mac, Visual Studio, nor any other environment.

How to build, run & debug

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

Installing templates

Templates can be installed from packages in any NuGet feed, directories on the file system or ZIP type archives (zip, nupkg, vsix, etc.) To install a new template use the command:

dotnet .\dotnet-new3.dll -i {the path to the folder containing the template or *.nupkg file or nuget package name}
dotnet .\dotnet-new3.dll -i "Boxed.Templates::*"
dotnet .\dotnet-new3.dll -i <your repo location>\artifacts\packages\Debug\Shipping\Microsoft.DotNet.Common.ProjectTemplates.3.1.6.0.0-dev.nupkg

Basic Commands

Showing help

dotnet .\dotnet-new3.dll --help
dotnet .\dotnet-new3.dll -h
dotnet .\dotnet-new3.dll

Listing templates

dotnet .\dotnet-new3.dll --list
dotnet .\dotnet-new3.dll -l
dotnet .\dotnet-new3.dll mvc -l            Lists all templates containing the text "mvc"

Template parameter help

dotnet .\dotnet-new3.dll mvc --help
dotnet .\dotnet-new3.dll mvc -h

Template creation

dotnet .\dotnet-new3.dll MvcWebTemplate --name MyProject --output src --ParameterName1 Value1 --ParameterName2 Value2 ... --ParameterNameN ValueN
dotnet .\dotnet-new3.dll MvcWebTemplate -n MyProject -o src --ParameterName1 Value1 --ParameterName2 Value2 ... --ParameterNameN ValueN

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.

templating-2's People

Contributors

ar-may avatar bekir-ozturk avatar bradwilson avatar brianrob avatar bricelam avatar cartermp avatar chad-ramos avatar csigs avatar damianedwards avatar danroth27 avatar davidfowl avatar davidkarlas avatar dotnet-bot avatar dotnet-maestro[bot] avatar eilon avatar genalt avatar haok avatar jmarkp avatar jonfortescue avatar lambdakris avatar livarcocc avatar mlorbetske avatar mmitche avatar phenning avatar sayedihashimi avatar seancpeters avatar smadala avatar vijayrkn avatar viktorhofer avatar vlada-shubina avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.