Install. NET CORECLR under Windows platform

Source: Internet
Author: User

. NET CoreCLR has released the RC1 version, and the installation method is as follows:

1. Install DNVM,DNVM is the. NET Runtime Manager, responsible for managing all versions of the. NET runtime (. NET Framework,. NET CORECLR, and Mono).

C:\coreclr-demo> @powershell-noprofile-executionpolicy Unrestricted-Command "&{$Branch = ' dev '; IEX ( (New-object net.webclient). Downloadstring (' Https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1 ')} "

After the installation is complete, you can run the DNVM list to view all installed. NET runtimes.

c:\coreclr-demo> DNVM List

2. Install the. NET CORECLR runtime.
Each type of runtime includes the x86 and x64 versions, which can increase the-arch specified CPU architecture.

To install the x86. NET CORECLR runtime, execute the following command:

c:\coreclr-demo> DNVM install-r coreclr latest-u

To install the x64. NET CORECLR Runtime, execute the following command:

c:\coreclr-demo> DNVM install-r Coreclr-arch x64 latest-u

After the installation is complete, you can perform the DNVM list to view the runtime of the installation.

C:\CORECLR-DEMO>DNVM List


After installation, you can set the. NET runtime that is used by default, using the DNVM use command.

 Use-R coreclr-arch x86 1.0.0-beta7-12364Adding C:\users\rlander\.dnx\runtimes\ dnx-coreclr-win-x86.1.0.0-beta7-12364\PATHC:\coreclr-demo>DNVM listactive Version           Runtime Architecture location                       Alias-------------           ---------------------------                       -----   *    1.0.0-beta7-12364 coreclr x86          C:\Users\rlander\.dnx\runtimes        1.0.0-beta7-12364 CORECLR x64          C:\Users\rlander\.dnx\runtimes

3. Write a Hello World program
When the. NET runtime is installed, we can write a console program to see the effect.

Create a file under the F:\Project\MyApp directory, named Program.cs, to write the following:

using System; namespace myapp{    publicclass  program    {        publicstatic void Main (string[] args)        {            Console.WriteLine ("Hello world! " );        }    }}

In the latest. NET version, the. NET project reads the Project.json file to get information such as the runtime, dependencies, program version, author, and so on that the. NET project supports.

Create a file under the F:\Project\MyApp directory, named Project.json, to write the following:

{  "Version": "1.0.0-*",  "description": "MyApp Console Application",  "Authors": ["Jim" ],  "Tags": ["" " ],  "Projecturl": "",  "Licenseurl": "",  "Compilationoptions": {    "Emitentrypoint":true  },  "Dependencies": {  },  "Commands": {    "MyApp": "MyApp"  },  "Frameworks": {      "Dnx451": {                 },      "Dnxcore50":{          "Dependencies": {            "Microsoft.csharp": "4.0.1-beta-23516",            "System.Collections": "4.0.11-beta-23516",            "System.Console": "4.0.0-beta-23516",            "System.Linq": "4.0.1-beta-23516",            "System.Threading": "4.0.11-beta-23516"          }     }  }}

4. Run the Hello World program

Dnu Restore reads the Project.json file, gets the related dependencies, and downloads the dependent DLL files from nuget.org.

Start the CMD command-line window, switch to the F:\PROJECT\MYAPP directory, and execute the dnu restore command:

F:\project\myapp>dnu Restore

Start the CMD command-line window, switch to the F:\PROJECT\MYAPP directory, and execute the DNX Run command:

f:\project\myapp>dnx RunhelloWorld!

Install. NET CORECLR under Windows platform

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.