try/README.md

86 строки
4.4 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">
|| [**Basics**](#basics) • [**Contribution Guidelines**](#contribution) • [**Experiences**](#experiences) || [**Setup**](#setup) • [**Getting Started**](#getting-started) || [**Samples**](https://github.com/dotnet/try-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-16 00:17:02 +03:00
[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/try/try-ci?branchName=master)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=495&branchName=master)
2019-09-19 21:38:25 +03:00
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dotnet/try/master)
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
2019-05-14 01:52:48 +03:00
## Contribution Guidelines
As we are still in the early stages of our development, we are unable to take any feature PRs at the moment but, we do intend to do this in the future.
2019-05-14 01:52:48 +03:00
Please feel free to file any bugs reports under our issues. And if you have any feature suggestion, please submit them under our issues using the community suggestions label.
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-21 05:09:55 +03:00
Microsoft Docs uses Try .NET to create interactive documentation. Users can run and edit code all 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-14 01:52:48 +03:00
Try .NET enables .NET developers to create interactive markdown files.
To make your markdown files interactive, you will need to [.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 any other 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
Before you get can start creating interactive documentation, you will need to install the following:
2019-05-14 01:52:48 +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.
- [dotnet try global tool](https://www.nuget.org/packages/dotnet-try/)
2019-05-12 18:52:15 +03:00
2019-05-14 01:52:48 +03:00
`dotnet tool install --global dotnet-try --version 1.0.19264.11`
2019-05-03 22:21:01 +03:00
Updating to the latest version of the tool is easy just run the command below
`dotnet tool update -g dotnet-try`
2019-05-14 01:52:48 +03:00
Once you have successfully installed `dotnet try` global tool, enter the command `dotnet try -h` you will 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-14 01:52:48 +03:00
2. `cd` to the `mydoc` folder and create a new console app with the following command
2019-05-03 23:14:57 +03:00
```console
2019-05-14 01:52:48 +03:00
> dotnet new console -o myApp
2019-05-03 23:14:57 +03:00
```
2019-05-14 01:52:48 +03:00
This will create a console app with the files `myApp.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-14 01:52:48 +03:00
```cs --source-file ./myApp/Program.cs --project ./myApp/myApp.csproj
2019-05-03 23:14:57 +03:00
```
````
5. Now, navigate back to the `mydoc` folder and run the following command:
2019-05-04 00:07:38 +03:00
```console
2019-05-14 01:52:48 +03:00
> dotnet try
2019-05-04 00:07:38 +03:00
```
2019-05-14 01:52:48 +03:00
You have created your first C# interactive developer experience. You should now be able to run your console app and see the result in the browser.
**Option 3**: Explore our [samples Repo](https://github.com/dotnet/try-samples).
- Clone the [dotnet/try-samples](https://github.com/dotnet/try-samples) repo.
- Follow the quick steps listed [here](https://github.com/dotnet/try-samples#basics) to get started.