Use 'webapp' alias for RP template (#6694)

pull/6702/merge
Luke Latham 2018-05-30 14:48:08 -05:00 committed by GitHub
parent 6ec799e30f
commit 8aa1b0815c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 219 additions and 9 deletions

View File

@ -13,7 +13,38 @@ uid: getting-started
---
# Get started with ASP.NET Core
::: moniker range=">= aspnetcore-2.0"
::: moniker range=">= aspnetcore-2.1"
1. Install the [!INCLUDE[](~/includes/net-core-sdk-download-link.md)].
2. Create a new .NET Core project.
On macOS and Linux, open a terminal window. On Windows, open a command prompt. Enter the following command:
```terminal
dotnet new webapp -o aspnetcoreapp
```
3. Run the app with the following commands:
```terminal
cd aspnetcoreapp
dotnet run
```
4. Browse to [http://localhost:5000](http://localhost:5000).
5. Open *Pages/About.cshtml* and modify the page to display the message "Hello, world! The time on the server is @DateTime.Now":
[!code-cshtml[](getting-started/sample/getting-started/about.cshtml?highlight=9&range=1-9)]
6. Browse to [http://localhost:5000/About](http://localhost:5000/About) and verify the changes.
[!INCLUDE[next steps](~/includes/getting-started/next-steps.md)]
::: moniker-end
::: moniker range="= aspnetcore-2.0"
1. Install the [!INCLUDE[](~/includes/net-core-sdk-download-link.md)].
@ -41,6 +72,7 @@ uid: getting-started
6. Browse to [http://localhost:5000/About](http://localhost:5000/About) and verify the changes.
[!INCLUDE[next steps](~/includes/getting-started/next-steps.md)]
::: moniker-end
::: moniker range="<= aspnetcore-1.1"

View File

@ -35,18 +35,48 @@ See [Get started with Razor Pages](xref:tutorials/razor-pages/razor-pages-start)
# [Visual Studio for Mac](#tab/visual-studio-mac)
::: moniker range=">= aspnetcore-2.1"
Run `dotnet new webapp` from the command line.
::: moniker-end
::: moniker range="= aspnetcore-2.0"
Run `dotnet new razor` from the command line.
::: moniker-end
Open the generated *.csproj* file from Visual Studio for Mac.
# [Visual Studio Code](#tab/visual-studio-code)
::: moniker range=">= aspnetcore-2.1"
Run `dotnet new webapp` from the command line.
::: moniker-end
::: moniker range="= aspnetcore-2.0"
Run `dotnet new razor` from the command line.
::: moniker-end
# [.NET Core CLI](#tab/netcore-cli)
::: moniker range=">= aspnetcore-2.1"
Run `dotnet new webapp` from the command line.
::: moniker-end
::: moniker range="= aspnetcore-2.0"
Run `dotnet new razor` from the command line.
::: moniker-end
---
## Razor Pages

View File

@ -183,7 +183,21 @@ Run the app.
Create a Razor Pages web app and a solution file containing the Razor Pages app and the Razor Class Library:
``` CLI
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp -o WebApp1
dotnet new sln
dotnet sln add WebApp1
dotnet sln add RazorUIClassLib
dotnet add WebApp1 reference RazorUIClassLib
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor -o WebApp1
dotnet new sln
dotnet sln add WebApp1
@ -191,14 +205,16 @@ dotnet sln add RazorUIClassLib
dotnet add WebApp1 reference RazorUIClassLib
```
::: moniker-end
Build and run the web app:
``` CLI
```console
cd WebApp1
dotnet run
```
------
---
<a name="test"></a>

View File

@ -31,11 +31,24 @@ See [this PDF file](https://github.com/aspnet/Docs/tree/master/aspnetcore/securi
# [ASP.NET Core 2.x](#tab/aspnetcore2x)
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp --auth Individual -o WebPWrecover
cd WebPWrecover
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor --auth Individual -o WebPWrecover
cd WebPWrecover
```
::: moniker-end
* `--auth Individual` specifies the Individual User Accounts project template.
* On Windows, add the `-uld` option. It specifies LocalDB should be used instead of SQLite.
* Run `new mvc --help` to get help on this command.

View File

@ -16,12 +16,26 @@ ASP.NET Core Identity is included in project templates in Visual Studio with the
The authentication templates are available in .NET Core CLI with `-au Individual`:
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new mvc -au Individual
dotnet new webapi -au Individual
dotnet new webapp -au Individual
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new mvc -au Individual
dotnet new webapi -au Individual
dotnet new razor -au Individual
```
::: moniker-end
The following articles show how to use the code generated in ASP.NET Core templates that use individual user accounts:
* [Two-factor authentication with SMS](xref:security/authentication/2fa)

View File

@ -74,7 +74,8 @@ Optional: Add the login partial (`_LoginPartial`) to the layout file:
## Scaffold identity into a Razor project with individual authorization
<!--
dotnet new razor -au Individual -o RPauth
Use >=2.1: dotnet new webapp -au Individual -o RPauth
Use = 2.0: dotnet new razor -au Individual -o RPauth
cd RPauth
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design -v "2.1.0-rc1-final"
dotnet restore

View File

@ -299,10 +299,22 @@ Create a contact in the administrator's browser. Copy the URL for delete and edi
* Create the app with **Individual User Accounts**.
* Name it "ContactManager" so your namespace matches the namespace used in the sample.
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp -o ContactManager -au Individual -uld
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor -o ContactManager -au Individual -uld
```
::: moniker-end
* `-uld` specifies LocalDB instead of SQLite
* Add the following `Contact` model:

View File

@ -108,16 +108,27 @@ Uncheck the **Configure for HTTPS** checkbox.
![Entity diagram](enforcing-ssl/_static/out.png)
# [.NET Core CLI](#tab/netcore-cli)
Use the `--no-https` option. For example
```cli
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp --no-https
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor --no-https
```
------
::: moniker-end
---
::: moniker-end

View File

@ -75,10 +75,22 @@ Visual Studio includes the `Microsoft.AspNetCore.SignalR` package containing its
1. From the **Integrated Terminal**, run the following command:
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp -o SignalRChat
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor -o SignalRChat
```
::: moniker-end
2. Install the JavaScript client library using *npm*.
```console

View File

@ -41,7 +41,25 @@ To complete this tutorial, you'll need:
Create a new directory for the web application, create a new ASP.NET Core MVC application, and then run the website locally.
# [Windows](#tab/windows)
```cmd
::: moniker range=">= aspnetcore-2.1"
```console
REM Create a new ASP.NET Core MVC application
dotnet new webapp -o MyApplication
REM Change to the new directory that was just created
cd MyApplication
REM Run the application
dotnet run
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
REM Create a new ASP.NET Core MVC application
dotnet new razor -o MyApplication
@ -52,7 +70,27 @@ REM Run the application
dotnet run
```
::: moniker-end
# [Other](#tab/other)
::: moniker range=">= aspnetcore-2.1"
```bash
# Create a new ASP.NET Core MVC application
dotnet new webapp -o MyApplication
# Change to the new directory that was just created
cd MyApplication
# Run the application
dotnet run
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```bash
# Create a new ASP.NET Core MVC application
dotnet new razor -o MyApplication
@ -63,6 +101,9 @@ cd MyApplication
# Run the application
dotnet run
```
::: moniker-end
---
![Command line output](publish-to-azure-webapp-using-cli/_static/new_prj.png)

View File

@ -25,12 +25,26 @@ This tutorial teaches the basics of building an ASP.NET Core Razor Pages web app
From a terminal, run the following commands:
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp -o RazorPagesMovie
cd RazorPagesMovie
dotnet run
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor -o RazorPagesMovie
cd RazorPagesMovie
dotnet run
```
::: moniker-end
The preceding commands use the [.NET Core CLI](https://docs.microsoft.com/dotnet/core/tools/dotnet) to create and run a Razor Pages project. Open a browser to http://localhost:5000 to view the application.
![Home or Index page](../razor-pages/razor-pages-start/_static/home.png)

View File

@ -25,12 +25,26 @@ This tutorial teaches the basics of building an ASP.NET Core Razor Pages web app
From a terminal, run the following commands:
::: moniker range=">= aspnetcore-2.1"
```console
dotnet new webapp -o RazorPagesMovie
cd RazorPagesMovie
dotnet run
```
::: moniker-end
::: moniker range="= aspnetcore-2.0"
```console
dotnet new razor -o RazorPagesMovie
cd RazorPagesMovie
dotnet run
```
::: moniker-end
The preceding commands use the [.NET Core CLI](https://docs.microsoft.com/dotnet/core/tools/dotnet) to create and run a Razor Pages project. Open a browser to http://localhost:5000 to view the application.
![Home or Index page](../razor-pages/razor-pages-start/_static/home.png)