try/README.md

83 строки
3.7 KiB
Markdown
Исходник Обычный вид История

2019-05-03 00:36:51 +03:00
# Try .NET <img src ="https://user-images.githubusercontent.com/2546640/56708992-deee8780-66ec-11e9-9991-eb85abb1d10a.png" width="80px" alt="dotnet bot in space" align ="right">
2019-05-03 22:21:01 +03:00
|| [**Basics**](#basics) • [**Experiences**](#experiences) || [**Setup**](#setup) • [**Getting Started**](#getting-started) || [**Samples**](Samples) ||
2017-09-23 04:47:48 +03:00
![Try_.NET Enabled](https://img.shields.io/badge/Try_.NET-Enabled-501078.svg)
2017-09-23 04:47:48 +03:00
2019-05-13 22:00:05 +03:00
*Please note that the dotnet try global tool isn't listed on NuGet yet. We will post the link as soon as it is available.*
2019-05-03 00:54:46 +03:00
## Basics
2019-05-03 03:36:03 +03:00
**What is Try .NET**: Try .NET is an interactive documentation generator for .NET Core.
2017-09-23 04:47:48 +03:00
**Please Note**: At the moment Try .NET only works with C# documentation.
2017-09-23 04:47:48 +03:00
**What is the repo for?**
- A place where you can post issues about [Try .NET](https://github.com/dotnet/try/issues).
- **Note:** The code for Try .NET is not currently hosted on GitHub.*(Coming soon)*
2019-05-03 03:36:03 +03:00
## Experiences
Use Try .NET to create executable C# snippets for your websites or, interactive markdown files that users can run on their machine.
**Websites**
2019-05-07 19:13:04 +03:00
Microsoft Docs uses Try .NET to create interactive documentation. Users can run and edit code in the browser.
2019-05-03 19:07:49 +03:00
![Try NET_online](https://user-images.githubusercontent.com/2546640/57144765-c850cc00-6d8f-11e9-982d-50d2b6dc3591.gif)
2019-05-03 03:36:03 +03:00
2019-05-03 19:07:49 +03:00
**Interactive .NET documentation**
2019-05-12 18:52:15 +03:00
Try .NET enables .NET developers to write documentation containing interactive code snippets using Markdown or HTML.
To make your Markdown files interactive, you will need the [.NET Core 3.0 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.0), the dotnet try global tool (*coming soon*) and [Visual Studio](https://visualstudio.microsoft.com/), [VS Code](https://code.visualstudio.com/), or another editor of your choice.
2019-05-03 22:21:01 +03:00
![interactive_doc](https://user-images.githubusercontent.com/2546640/57158389-47a2c780-6db1-11e9-96ad-8c6e9ab52853.png)
## Setup
2019-05-12 18:52:15 +03:00
2019-05-03 22:21:01 +03:00
Before you get can start creating interactive documentation, you will need to install the following:
2019-05-13 22:01:52 +03:00
- [.NET Core 3.0 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.0)and [2.1](https://dotnet.microsoft.com/download/dotnet-core/2.1) currently dotnet try global tool targets 2.1.
2019-05-12 18:52:15 +03:00
- [dotnet try global tool] (*coming soon*)
Once you have successfully installed `dotnet try`, enter the command `dotnet try -h` to see a list of commands:
| Command | Purpose |
|----------------|---------------------------------------------------------------------|
| `demo` | Learn how to create Try .NET content with an interactive demo |
| `verify` | Verify Markdown files in the target directory and its children. |
2019-05-03 22:21:01 +03:00
## Getting Started
2019-05-03 23:14:57 +03:00
You can get started using either one of the options below.
**Option1**: `dotnet try demo`
- Create a new folder.
- `cd` to your new folder.
- Run command `dotnet try demo`
**Option 2**: Starting from scratch.
1. Go to the terminal and create a folder called `mydoc`.
2019-05-12 18:52:15 +03:00
2. `cd` to the `mydoc` folder and create a new console app by running the following command:
2019-05-03 23:14:57 +03:00
```console
2019-05-12 18:52:15 +03:00
> dotnet new console -o myApp
2019-05-03 23:14:57 +03:00
```
2019-05-12 18:52:15 +03:00
This will create a console app with the files `mydoc.csproj` and `Program.cs`.
2019-05-03 23:14:57 +03:00
2019-05-04 19:46:15 +03:00
3. Open `mydoc`folder in Visual Studio Code.
2019-05-03 23:14:57 +03:00
4. Create a file called `doc.md`. Inside that file, add some text and a code fence:
````markdown
# My Interactive Document:
2019-05-12 18:52:15 +03:00
```cs --source-file ./mydoc/Program.cs --project ./mydoc/mydoc.csproj
2019-05-03 23:14:57 +03:00
```
````
2019-05-12 18:52:15 +03:00
2019-05-03 23:14:57 +03:00
5. Now, navigate back to the `mydoc` folder and run the following command:
2019-05-12 18:52:15 +03:00
2019-05-04 00:07:38 +03:00
```console
2019-05-12 18:52:15 +03:00
> dotnet try
2019-05-04 00:07:38 +03:00
```
2019-05-12 18:52:15 +03:00
You can now run your sample code in the browser.
**Option 3**: Explore our [samples folders](Samples).
2019-05-04 00:10:07 +03:00
- Read our quick [setup guide](Samples/Setup.md).