Skip to content

Commit

Permalink
ReplayCheck for top-level-templates.md (#39634)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdykstra authored Feb 22, 2024
1 parent 9cb45cf commit ec55e88
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .replaycheck/docs/core/tutorials/top-level-templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# %version 1
contentPath: docs\core\tutorials\top-level-templates.md

steps:
- task: RunCustomCommand@1
command: dotnet new console
environment:
type: dotnet-sdk
uid: "59806399"
- task: RunCustomCommand@1
command: cat Program.cs
environment:
type: dotnet-sdk
uid: fb69a9
- task: CheckCodeSnippet@1
contentValidationRules:
- operator: contains
source: Task output
value: fb69a9 (Run a custom command)
uid: 4ba1bc63
- task: RunCommand@1
environment:
type: dotnet-sdk
uid: 834a9e04
- task: RunCustomCommand@1
command: cd MyProject
environment:
type: dotnet-sdk
uid: 52e0335c
- task: RunCustomCommand@1
command: mkdir MyProject
environment:
type: dotnet-sdk
uid: 7428562a
- task: RunCustomCommand@1
command: cat Program.cs
environment:
type: dotnet-sdk
uid: d206d530
- task: CheckCodeSnippet@1
contentValidationRules:
- operator: contains
source: Task output
value: d206d530 (Run a custom command)
uid: eedff294
8 changes: 8 additions & 0 deletions docs/core/tutorials/top-level-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ms.date: 11/08/2022

Starting with .NET 6, the project template for new C# console apps generates the following code in the *Program.cs* file:

<!-- replaycheck-task id="59806399" -->
<!-- replaycheck-task id="fb69a9" -->
<!-- replaycheck-task id="4ba1bc63" -->
```csharp
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Expand Down Expand Up @@ -101,12 +104,17 @@ You can also add a [`<Using>`](../project-sdk/msbuild-props.md#using) item with

Starting with .NET SDK 6.0.300, the `console` template has a `--use-program-main` option. Use it to create a console project that doesn't use top-level statements and has a `Main` method.

<!-- replaycheck-task id="7428562a" -->
<!-- replaycheck-task id="52e0335c" -->
<!-- replaycheck-task id="834a9e04" -->
<!-- replaycheck-task id="d206d530" -->
```dotnetcli
dotnet new console --use-program-main
```

The generated `Program.cs` is as follows:

<!-- replaycheck-task id="eedff294" -->
```csharp
namespace MyProject;

Expand Down

0 comments on commit ec55e88

Please sign in to comment.