Skip to content

Commit c81b114

Browse files
committed
Add set-up instructions
1 parent e0d2ff9 commit c81b114

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ This documentation contains examples for using [MoreLINQ]. The examples can be
55
run and tested interactively in a browser using [`dotnet try`
66
(Try .NET)][dotnet-try].
77

8+
See [Setup](setup.md) for requirements and installation instructions.
9+
810

911
## Examples
1012

setup.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Setup
2+
3+
Example code is written directly into Markdown documents, which requires
4+
nothing more than a text editor. However, to develop, run and test those
5+
examples interactively and ensure their correctness, you will need
6+
[Try .NET][dotnet-try] installed as a global tool using:
7+
8+
dotnet tool install -g dotnet-try --version 1.0.19266.1
9+
10+
Once installed, simply run `dotnet try` in a directory with a clone of the
11+
repository containing this documentation.
12+
13+
Try .NET requires [.NET Core 3.0 SDK][netcore3] _and_ [2.1][netcore21] to be
14+
installed prior to its installation and use.
15+
16+
If you have [Docker] installed, you can get Try .NET and its requirements
17+
setup in a ready-to-run container image without affecting your local setup.
18+
To do so, create a file named `Dockerfile` with the following content:
19+
20+
```Dockerfile
21+
FROM microsoft/dotnet:3.0-sdk
22+
23+
ENV PATH="${PATH}:/root/.dotnet/tools"
24+
25+
RUN dotnet tool install -g dotnet-try --version 1.0.19266.1 \
26+
&& curl -k https://dot.net/v1/dotnet-install.sh \
27+
| bash /dev/stdin --install-dir /usr/share/dotnet --version 2.1.503 \
28+
&& mkdir /doc
29+
30+
WORKDIR /doc
31+
32+
ENTRYPOINT ["dotnet", "try"]
33+
```
34+
35+
Next, build the image, tagging it `dotnet-try`:
36+
37+
docker build -t dotnet-try .
38+
39+
Then whenever you wish to develop, run and test the code in the Markdown
40+
documents, change the current working directory of your shell (`cd`) to where
41+
you cloned the repository containing the documents and run the image using:
42+
43+
docker run -ti --rm -p 5000:80 -v "$(pwd):/doc" dotnet-try
44+
45+
If you are using PowerShell, run instead using:
46+
47+
docker run -ti --rm -p 5000:80 -v "$($PWD)/doc" dotnet-try
48+
49+
If you are using the Windows Command Prompt (`cmd.exe`), run instead
50+
using:
51+
52+
docker run -ti --rm -p 5000:80 -v "%cd%/doc" dotnet-try
53+
54+
Finally, open a browser and navigate to `http://localhost:5000/README.md`.
55+
56+
57+
[dotnet-try]: https://github.com/dotnet/try
58+
[dotnet-try-setup]: https://github.com/dotnet/try/blob/301dacfdd8af34586def0722a08452bab6393bc9/README.md#setup
59+
[netcore21]: https://dotnet.microsoft.com/download/dotnet-core/2.1
60+
[netcore3]: https://dotnet.microsoft.com/download/dotnet-core/3.0
61+
[docker]: https://www.docker.com/

0 commit comments

Comments
 (0)