Skip to content

Commit 525604e

Browse files
author
Zlatko Knezevic
committed
Merge pull request #2 from blackdwarf/GettingStarted
Documentation for installing .NET Core & Desktop
2 parents e775f67 + 6683cc2 commit 525604e

File tree

5 files changed

+451
-21
lines changed

5 files changed

+451
-21
lines changed

docs/getting-started/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ Getting started
33

44
.. toctree::
55
:titlesonly:
6-
6+
77
overview
8-
installing-desktop
98
installing-core-windows
109
installing-core-linux
1110
installing-core-macosx
12-
Lines changed: 168 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,172 @@
11
.. include:: /stub-topic.txt
22

3-
|stub-icon| Installing .NET Core on Linux
3+
Installing .NET Core on Linux
44
=========================================
55

6-
.. include:: /stub-notice.txt
7-
6+
These instructions will lead you through acquiring the .NET Core DNX SDK
7+
via the `.NET Version Manager (DNVM) <https://github.com/aspnet/dnvm>`__
8+
and running a "Hello World" demo on Linux.
9+
10+
.NET Core NuGet packages and the .NET Core DNX SDKs are available on the
11+
`ASP.NET 'vnext' myget feed <https://www.myget.org/F/aspnetvnext>`__,
12+
which you can more easily view on
13+
`gallery <https://www.myget.org/gallery/aspnetvnext>`__ for the feed.
14+
15+
Setting up the environment
16+
--------------------------
17+
18+
These instructions have been written and tested on Ubuntu 14.04 LTS, since that is the main Linux distribution the .NET Core team uses. These instructions may succeed on other distributions as well. We are always accepting new pull requests on `our GitHub repo <https://www.github.com/dotnet/coreclr/>`_ that address running on other Linux distributions. The only requirement is that they do not break the ability to use Ubuntu 14.04 LTS.
19+
20+
Installing the required packages
21+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
23+
Install the ``libunwind8``, ``libssl-dev`` and ``unzip`` packages:
24+
25+
::
26+
27+
sudo apt-get install libunwind8 libssl-dev unzip
28+
29+
You also need a latest version of Mono, which is required for DNX tooling. This is a temporary requirement, and will not be required in the future.
30+
31+
::
32+
33+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
34+
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
35+
sudo apt-get update
36+
sudo apt-get install mono-complete
37+
38+
Certificates
39+
^^^^^^^^^^^^
40+
41+
You need to import trusted root certificates in order to restore NuGet packages. You can do that with the ``mozroots`` tool.
42+
43+
::
44+
45+
mozroots --import --sync
46+
47+
Installing DNVM
48+
---------------
49+
50+
You need DNVM as a starting point. DNVM enables you to acquire one or multiple .NET Execution Environments (DNX). DNVM is a shell script and does not require .NET. You can use the below command to install it.
51+
52+
::
53+
54+
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
55+
56+
Installing the .NET Core DNX
57+
----------------------------
58+
59+
You first need to acquire the Mono DNX. It doesn't include Mono, but is
60+
needed to use the DNX tools on top of Mono. In particular, the DNU
61+
command is not yet supported on .NET Core, requiring us to use Mono for
62+
this purpose (until DNU runs on .NET Core). Mono is the default DNX, so
63+
you can acquire it via ``dnvnm upgrade``.
64+
65+
::
66+
67+
dnvm upgrade -u
68+
69+
Next, acquire the .NET Core DNX SDK.
70+
71+
::
72+
73+
dnvm install latest -r coreclr -u
74+
75+
You can see the currently installed DNX versions with ``dnvm list``.
76+
77+
::
78+
79+
dnvm list
80+
81+
::
82+
83+
Active Version Runtime Arch Location Alias
84+
------ ------- ------- ---- -------- -----
85+
* 1.0.0-beta5-11649 coreclr x64 ~/.dnx/runtimes
86+
1.0.0-beta5-11649 mono ~/.dnx/runtimes default
87+
88+
Using a specific runtime
89+
------------------------
90+
91+
You can choose which of the installed DNXs you want to use with ``dnvm use``, specifying arguments that are similar to the ones used when installing a runtime.
92+
93+
::
94+
95+
dnvm use -r coreclr -arch x86 1.0.0-beta5-11649
96+
Adding ~/.dnx/runtimes/dnx-coreclr-win-x86.1.0.0-beta5-11649/bin
97+
to process PATH
98+
99+
dnvm list
100+
101+
Active Version Runtime Arch Location Alias
102+
------ ------- ------- ---- -------- -----
103+
* 1.0.0-beta5-11649 coreclr x64 ~/.dnx/runtimes
104+
1.0.0-beta5-11649 mono ~/.dnx/runtimes default
105+
106+
See the asterisk in the listing above? It's purpose is to tell you which runtime is now active. "Active" here means that all of the interaction with your projects and .NET Core will use this runtime.
107+
108+
That's it! You now have the .NET Core runtime installed on your machine and it is time to take it for a spin.
109+
110+
Write your App
111+
--------------
112+
113+
his being an introduction-level document, it seems fitting to start with a "Hello World" app. Here's a very simple one you can copy and paste into a CS file in a directory.
114+
115+
.. code:: csharp
116+
117+
using System;
118+
119+
public class Program
120+
{
121+
public static void Main (string[] args)
122+
{
123+
Console.WriteLine("Hello, Linux");
124+
Console.WriteLine("Love from CoreCLR.");
125+
}
126+
}
127+
128+
A more ambitious example is available on the `corefxlab repo <https://www.github.com/dotnet/corefxlab/>`_ that will print out a pretty picture based on the argument you provide at runtime. If you wish to use this example, simply save the `C# file <https://raw.githubusercontent.com/dotnet/corefxlab/master/demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs>`_ to a directory somewhere on your machine.
129+
130+
The next thing you will need is a ``project.json`` file that will outline the dependencies of an app, so you can **actually** run it. Use the contents below, it will work for both examples above. Save this file in a directory next to the CS file that contains your code.
131+
132+
::
133+
134+
{
135+
"version": "1.0.0-*",
136+
"dependencies": {
137+
},
138+
"frameworks" : {
139+
"dnx451" : { },
140+
"dnxcore50" : {
141+
"dependencies": {
142+
"System.Console": "4.0.0-beta-*"
143+
}
144+
}
145+
}
146+
}
147+
148+
Run your App
149+
------------
150+
151+
You need to restore packages for your app, based on your project.json,
152+
with ``dnu restore``. You will need to run this command under the Mono
153+
DNX. The first command switches the active runtime to the Mono one.
154+
155+
::
156+
157+
dnvm use 1.0.0-beta5-11649 -r mono
158+
dnu restore
159+
160+
You are now ready to run your app under .NET Core. As you can guess, however, before you do that you first need to switch to the .NET Core runtime. The first command below does exactly that.
161+
162+
::
163+
164+
dnvm use 1.0.0-beta5-11649 -r coreclr
165+
dnx . run
166+
167+
Hello, Linux
168+
Love from CoreCLR.
169+
170+
Building .NET Core from source
171+
------------------------------
172+
.NET Core is an open source project that is hosted on GitHub. This means that you can, at any given time, clone the repository and build .NET Core from source. This is a more advanced scenario that is usually used when you want to add features to the .NET runtime or the BCL or if you are a contributor to these projects. The detailed instruction on how to build .NET Core windows can be found in the `.NET Core OS X build instructions <https://github.com/dotnet/coreclr/blob/master/Documentation/linux-instructions.md>`_ on GitHub.
Lines changed: 150 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,153 @@
11
.. include:: /stub-topic.txt
22

3-
|stub-icon| Installing .NET Core on MacOSX
4-
==========================================
3+
Installing .NET Core on OS X
4+
==============================
55

6-
.. include:: /stub-notice.txt
7-
6+
These instructions will lead you through acquiring the .NET Core DNX SDK
7+
via the `.NET Version Manager (DNVM) <https://github.com/aspnet/dnvm>`__
8+
and running a "Hello World" demo on OS X.
9+
10+
.NET Core NuGet packages and the .NET Core DNX SDKs are available on the
11+
`ASP.NET 'vnext' myget feed <https://www.myget.org/F/aspnetvnext>`__,
12+
which you can more easily view on
13+
`gallery <https://www.myget.org/gallery/aspnetvnext>`__ for the feed.
14+
15+
16+
Installing DNVM
17+
---------------
18+
19+
You need DNVM as a starting point. DNVM enables you to acquire one or
20+
multiple .NET Execution Environments (DNX). DNVM is simply a script,
21+
which doesn't depend on .NET. On OS X the best way to get DNVM is to use `Homebrew <http://www.brew.sh>`__. If
22+
you don't have Homebrew installed then follow the `Homebrew installation
23+
instructions <http://www.brew.sh>`__. Once you have Homebrew up and running you can use the the following commands:
24+
25+
::
26+
27+
brew tap aspnet/dnx
28+
brew update
29+
brew install dnvm
30+
31+
You will likely need to register the dnvm command:
32+
33+
::
34+
35+
source dnvm.sh
36+
37+
Installing the .NET Core DNX
38+
----------------------------
39+
40+
Since .NET Core is still a work in progress, you will need to make use of `Mono <http://www.mono-project.com>`_ to run certain parts of the DNX tooling. On non-Windows operating systems, Mono is the default DNX, so you can use a simple ``dnvm upgrade`` command to install it.
41+
42+
::
43+
44+
dnvm upgrade -u
45+
46+
Next, acquire the .NET Core DNX SDK.
47+
48+
::
49+
50+
dnvm install latest -r coreclr -u
51+
52+
You can see the currently installed DNX versions with ``dnvm list``.
53+
54+
::
55+
56+
dnvm list
57+
58+
::
59+
60+
Active Version Runtime Arch Location Alias
61+
------ ------- ------- ---- -------- -----
62+
* 1.0.0-beta5-11649 coreclr x64 ~/.dnx/runtimes
63+
1.0.0-beta5-11649 mono ~/.dnx/runtimes default
64+
65+
.. note::
66+
The version numbers above can and will change when you run the commands, which is normal. Don't forget to use the proper numbers when further interacting with DNVM in the below samples.
67+
68+
Using a specific runtime
69+
------------------------
70+
71+
You can choose which of the installed DNXs you want to use with ``dnvm use``, specifying arguments that are similar to the ones used when installing a runtime.
72+
73+
::
74+
75+
dnvm use -r coreclr -arch x64 1.0.0-beta5-11649
76+
Adding ~/.dnx/runtimes/dnx-coreclr-win-x86.1.0.0-beta5-11649/bin
77+
to process PATH
78+
79+
dnvm list
80+
81+
Active Version Runtime Arch Location Alias
82+
------ ------- ------- ---- -------- -----
83+
* 1.0.0-beta5-11649 coreclr x64 ~/.dnx/runtimes
84+
1.0.0-beta5-11649 mono ~/.dnx/runtimes default
85+
86+
See the asterisk in the listing above? It's purpose is to tell you which runtime is now active. "Active" here means that all of the interaction with your projects and .NET Core will use this runtime.
87+
88+
That's it! You now have the .NET Core runtime installed on your machine and it is time to take it for a spin.
89+
90+
91+
Write your App
92+
--------------
93+
94+
This being an introduction-level document, it seems fitting to start with a "Hello World" app. Here's a very simple one you can copy and paste into a CS file in a directory.
95+
96+
.. code:: csharp
97+
98+
using System;
99+
100+
public class Program
101+
{
102+
public static void Main (string[] args)
103+
{
104+
Console.WriteLine("Hello, OS X");
105+
Console.WriteLine("Love from CoreCLR.");
106+
}
107+
}
108+
109+
A more ambitious example is available on the `corefxlab repo <https://www.github.com/dotnet/corefxlab/>`_ that will print out a pretty picture based on the argument you provide at runtime. If you wish to use this example, simply save the `C# file <https://raw.githubusercontent.com/dotnet/corefxlab/master/demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs>`_ to a directory somewhere on your machine.
110+
111+
The next thing you will need is a ``project.json`` file that will outline the dependencies of an app, so you can **actually** run it. Use the contents below, it will work for both examples above. Save this file in a directory next to the CS file that contains your code.
112+
113+
::
114+
115+
{
116+
"version": "1.0.0-*",
117+
"dependencies": {
118+
},
119+
"frameworks" : {
120+
"dnx451" : { },
121+
"dnxcore50" : {
122+
"dependencies": {
123+
"System.Console": "4.0.0-beta-*"
124+
}
125+
}
126+
}
127+
}
128+
129+
Run your App
130+
------------
131+
132+
You need to restore packages for your app, based on your project.json,
133+
with ``dnu restore``. You will need to run this command under the Mono
134+
DNX. The first command switches the active runtime to the Mono one.
135+
136+
::
137+
138+
dnvm use 1.0.0-beta5-11649 -r mono
139+
dnu restore
140+
141+
You are now ready to run your app under .NET Core. As you can guess, however, before you do that you first need to switch to the .NET Core runtime. The first command below does exactly that.
142+
143+
::
144+
145+
dnvm use 1.0.0-beta5-11649 -r coreclr
146+
dnx . run
147+
148+
Hello, OSX
149+
Love from CoreCLR.
150+
151+
Building .NET Core from source
152+
------------------------------
153+
.NET Core is an open source project that is hosted on GitHub. This means that you can, at any given time, clone the repository and build .NET Core from source. This is a more advanced scenario that is usually used when you want to add features to the .NET runtime or the BCL or if you are a contributor to these projects. The detailed instruction on how to build .NET Core windows can be found in the `.NET Core OS X build instructions <https://github.com/dotnet/coreclr/blob/master/Documentation/osx-instructions.md>`_ on GitHub.

0 commit comments

Comments
 (0)