. Net Core Environment Setup

Source: Internet
Author: User
Tags dotnet net command net command line

. Net Core Series: 1, Environment building


June 28, 2016 Microsoft announces the release of. NET core 1.0, ASP. NET Core 1.0, and Entity Framework Core 1.0. The Microsoft Open source cross-platform. NET Framework project, launched two years ago, supports Windows, OS X and Linux platforms that can be used to develop various types of applications. This release includes the. NET core runtimes, libraries, and tools, as well as the ASP. Microsoft has also released Visual Studio and Visual Studio Code extensions that allow developers to create. NET core projects. If you are building a. NET core application using Visual Studio, the developer will need to install the latest Visual Studio update 32.

The. NET Core currently has many features that are not comparable to the traditional framework and mono. And in the migration of old projects, the support of various open source class libraries, is currently relatively scarce. Many people will wonder what challenges Microsoft has been able to solve with a. NET core, ASP, and Entity Framework core that has been released for 2 years. What kind of business can we use them to accomplish?

But no matter what the business, the Million line "code" from Hello Word .....

First, Environment construction

No matter what language you use, programming must be the first thing to learn, the environment to build. Humans are high-level animals, because humans use tools, and the environment is actually the process of constructing tools. At present, the official online (https://www.microsoft.com/net/core#windows) has a Windows, Linux, MAC, Docker Environment tutorial, relatively clear, but this site is about the use of the development environment, What about the operating environment? is not described in detail. And for the development environment for the old net people, has always been artifact in the hand (Visual Studio 201x) What development environment is a key to fix. But this one-button fix in the cross-platform created a variety of pits.

It is customary for us to install the. NET core SDK when we install the development environment, and to install the. NET core when running the environment

. NET Core SDK = Develop apps with. NET Core and the SDK+CLI (software development kit/command line Interface) tools
. NET core = Run apps with the. NET Core runtime

Because I am more familiar with the Linux CentOS 7 so I will be based on CentOS 7 to tell.

Centos 7.1 Installation development environment

#依赖包sudo is the Yum install Libunwind libicu# development environment downloaded or Preview2curl-ssl-o dotnet.tar.gz https://go.microsoft.com/fwlink/? linkid=809131# official website is to install files into the/opt/directory sudo mkdir-p/opt/dotnet && sudo tar zxf dotnet.tar.gz-c/opt/dotnetsudo mkdir- p/usr/share/dotnet-dev-1.0.0 && tar zxf dotnet.tar.gz-c/usr/share/dotnet-dev-1.0.0# map dotnet Execution program to/usr/ Bin execution directory; sudo ln-s/usr/share/dotnet-dev-1.0.0/dotnet/usr/bin

dotnet--help display information as shown below

[[email protected] hellword]# dotnet--help.net Command line Tools (1.0.0-preview2-003121) usage:dotnet [           Host-options] [command] [arguments] [common-options]arguments: [command] the command to execute [arguments]      Arguments to pass to the command [host-options] options specific to dotnet (host) [Common-options] Options common to all Commandscommon options:-v|--verbose Enable verbose output-h|--help Show He Lphost options (passed before the command):-v|--verbose Enable verbose output--version Display. N ET CLI Version number--info Display. NET CLI infocommon commands:new Initialize a basic. Net       Project restore restore dependencies specified in the. NET project build Builds A. NET project Publish Publishes A. NET Project for deployment (including the runtime) run compiles and immediately executes a. NET Project Test Runs Unit TESTs using the test runner specified in the project pack creates a NuGet package 

  Centos 7.1 Installation Operating environment

#依赖包sudo Yum Install libunwind libicu# run environment download Curl-ssl-o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/ preview/binaries/1.0.0/dotnet-centos-x64.1.0.0.tar.gz# official website is to install files to the/opt/directory sudo mkdir-p/opt/dotnet && sudo tar ZXF dotnet.tar.gz-c/opt/dotnetsudo mkdir-p/usr/share/dotnet-1.0.0 && tar zxf dotnet.tar.gz-c/usr/share/dotne t-1.0.0# Map the dotnet executor to the/usr/bin execution directory; sudo ln-s/usr/share/dotnet-1.0.0/dotnet/usr/bin

dotnet--help display information as shown below

 [[email protected] dotnet]# dotnet--helpmicrosoft. NET Core Shared Framework Host version:1.0.1 Build: cee57bf6c981237d80aa1631cfe83cb9ba329f12usage:dotnet [common-options] [options] Path-to-application]common  Options:--help Display. NET Core Shared Framework Host help. --version Display. NET Core Shared Framework Host version.  Options:--fx-version <version> version of the installed Shared Framework to use to run the application. --additionalprobingpath <path> path containing probing policy and assemblies to probe for. Path to Application:the path to a. NET Core managed application, DLL or EXE file to execute. If You is debugging the Shared Framework Host, set ' Corehost_trace ' to ' 1 ' in your environment. To get started on developing applications for. NET Core, install the. NET SDK from:http://go.microsoft.com/fwlink/? linkid=798306&clcid=0x409 

Windows Installation development environment (non-vs2015)

(only under Win10 can be executed using the command line, under Win7 Error: Failed to load the DLL from [C:\Program files\dotnet\host\fxr\1.0.1\ Hostfxr.dll], hresult:0x80070057)

Download dotnetcore.1.0.0-sdk.preview2-x64:https://download.microsoft.com/download/a/3/8/ A38489f3-9777-41dd-83f8-2cbdfab2520c/packages/dotnetcore.1.0.0-sdk.preview2-x64.exe

Windows Ten installation run environment

Download dotnetcore.1.0.0-runtime-x64.exe:https://download.microsoft.com/download/a/3/8/ A38489f3-9777-41dd-83f8-2cbdfab2520c/packages/dotnetcore.1.0.0-runtime-x64.exe

Docker installation Runtime environment

The Docker on the website is based on Debian, and I use Docker to mirror CentOS, so I have to write my own dockerfile to build my Docker images

# VERSION 1.0FROM maydear.com/centos:7 #//is actually the official image change tag, their own Docker pull CentOS after modifying the statement maintainer Kelvin "[email protected]" # Update system source Run yum-y update && yum clean all# Install dependent package run Yum-y install libunwind libicu# install. NET coreenv Dotnet_ver SION 1.0.0ENV dotnet_download_url https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$DOTNET _version /dotnet-centos-x64. $DOTNET _version.tar.gzrun curl-ssl-o dotnet.tar.gz $DOTNET _download_url# installation dotnet Corerun mkdir-p /usr/share/dotnet-$DOTNET _version && tar zxf dotnet.tar.gz-c/usr/share/dotnet-$DOTNET _version# install dotnet Core To the start command run ln-s/usr/share/dotnet-$DOTNET _version/dotnet/usr/binrun rm-rf dotnet.tar.gzCMD ["/bin/bash"] #build image:# sudo docker build--rm-t= "maydear.com/dotnet:1.0". #run container: #sudo Docker run-it--name=dotnet-d-v/xxx:/xxx--PR Ivileged=true maydear.com/dotnet:1.0

Second, the first. Net Core Program

Centos 7 Seconds out Hello World

mkdir HELLOWORLDCD helloworldsudo dotnet new && dotnet restore && dotnet Build

sudo dotnet Run

Release dotnet Core Program

sudo dotnet Publish

Copy files to the running server and run

Iii. development of the first Hello Word using VS2015

1. Install Visual Studio Community Update 3 (slightly: )

2, install Dotnetcore.1.0.0.rc2-vs2015tools.preview1 plug-in. http://download.microsoft.com/download/A/3/8/A38489F3-9777-41DD-83F8-2CBDFAB2520C/ Dotnetcore.1.0.0-vs2015tools.preview2.exe

3. Create a project

Iv. Summary


{"  version": "1.0.0-*",/* Program version was previously written in assemblyinfo*/  "Buildoptions": {    "emitentrypoint": True  },  " Dependencies ": {/* Dependency (Reference package) */    " Microsoft.NETCore.App ": {        " type ":" Platform ",        " version ":" 1.0.0 "    },    "test": "1.0.2-*"/* my own definition of the net Core class library, test the class library Reference *  /},  "frameworks": {"    netcoreapp1.0": {        " Imports ":" Dnxcore50 "}}  }

The only difference from the Hello World habit is that. NET core references a package through NuGet, but NuGet throws an error if it does not have a package that supports. NET Core:

This nuget automatic recognition is expected to have stronger optimizations in Nuget3.0.

Category:. Net Core

. Net Core Environment Setup

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.