Install. net coreclr and. netcoreclr on Windows.

Source: Internet
Author: User

Install. net coreclr and. netcoreclr on Windows.

. Net coreclr has released RC1. The installation method is as follows:

1. Install DNVM. DNVM is the. net runtime manager that manages all versions of. 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, run the dnvm list to view all installed. net runtime.

C:\coreclr-demo> dnvm list

2. Install. net coreclr at runtime.
Each type of operation includes x86 and x64 versions. You can add-arch to specify the CPU architecture.

Run the following command to install x86. net coreclr:

C:\coreclr-demo> dnvm install -r coreclr latest -u

Run the following command to install x64. net coreclr:

C:\coreclr-demo> dnvm install -r coreclr -arch x64 latest -u

After the installation is complete, run the dnvm list to view the running time of the installation.

C:\coreclr-demo>dnvm list


After installation, you can set the default. net runtime to use the dnvm use command.

C:\coreclr-demo>dnvm use -r coreclr -arch x86 1.0.0-beta7-12364Adding C:\Users\rlander\.dnx\runtimes\dnx-coreclr-win-x86.1.0.0-beta7-12364\binto process 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
After installing. net, we can write a console program to check the effect.

In the F: \ Project \ MyApp directory, create a file named Program. cs and write the following content:

using System;namespace MyApp{    public class Program    {        public static void Main(string[] args)        {            Console.WriteLine("Hello World!");        }    }}

In the latest. net version, the. net project reads the project. json file to obtain information such as runtime, dependency, program version, and author supported by the. net project.

Create a file named Project. json in the F: \ project \ MyApp directory and write the following content:

{    "version": "1.0.0-*",    "description": "MyApp Console Application",    "authors":["Jim"],    "tags": [ "" ],    "projectUrl": "",    "licenseUrl": "",        "compilationOptions": {        "emitEntryPoint": true    },    "dependencies": {    },        "commands": {        "MyApp": "MyApp"    },        "frameworks": {        "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

Note:

In VS2015, you do not need to modify the NuGet. Config file.

For versions earlier than VS2015 (VS2013, VS2012, VS2010) and nuget versions earlier than v2, you need to change the source of. net coreclr to the following address:

Enter the PATH % AppData % \ NuGet in the resource manager and press enter to modify the NuGet. Config file,

In the <packageSources> section, add the following content:

    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/" />    <add key="api.nuget.org" value="https://www.nuget.org/api/v2" />

The other content of the Nuget. Config file remains unchanged.

 

The content of the modified Nuget. Config file is as follows.

<? Xml version = "1.0" encoding = "UTF-8"?> <Configuration> <packageSources> <add key = "NuGet official package source" value = "https://nuget.org/api/v2/"/> <add key = "NewPackageSource" value = "http://go.microsoft.com/fwlink? LinkID = 206669 "/> <add key =" dotnet-core "value =" https://dotnet.myget.org/F/dotnet-core/ "/> <add key =" api.nuget.org "value =" https://www.nuget.org/api/v2 "/> </packageSources> <disabledPackageSources/> <activePackageSource> <add key = "NuGet official package source" value = "https://nuget.org/api/v2/"/> </activePackageSource> <packageRestore> <add key = "enabled" value = "False"/> <add key = "automatic" value = "False"/> </packageRestore> </configuration>

 

Dnu restore reads the project. json file, obtains the dependency, and downloads the dependent dll file from nuget.org.

Start the cmd command line window, switch to the F: \ Project \ MyApp directory, and run the dnu restore command:

F:\Project\MyApp>dnu restore

Start the cmd command line window, switch to the F: \ Project \ MyApp directory, and run the dnx run command:

F:\Project\MyApp>dnx runHello World!

 

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.