. NET Core 2.0 and ASP 2.0 official first-edition early-Experience

Source: Internet
Author: User
Tags dotnet windows x64

. NET Core 2.0 and ASP 2.0 official first-edition early-Experience

. NET Standard 2.0 are final

Broad platform Support. . NET Standard 2.0 are supported on the following platforms:

    • . NET Framework 4.6.1
    • . NET Core 2.0
    • Mono 5.4
    • Xamarin.ios 10.14
    • Xamarin.mac 3.8
    • Xamarin.android 7.5
    • UWP is work in progress and would ship later this year.

https://github.com/dotnet/standard/issues/439

. NET Core 2.0 Release NuGet library: Https://dotnet.myget.org/gallery/dotnet-2-0-0-rtm

The. NET Core 2.0 release time will be published on. NET Conf. The specific time is September 18 or 19th.

. NET Core 2.0.1 SDK Windows x64 Download

Https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-win-x64.exe

More versions Download: https://github.com/dotnet/cli/tree/release/2.0.0

Here's a formal experience. This article uses the SDK to compress packages.

New Project

Dotnet--info

Console

New Project dotnet new console

In the project directory, add the following nuget.config:

<?xml version="1.0" encoding="utf-8"?>< configuration>    <packageSources>        <clear/>        <add key="Dotnet-2-0-0-rtm  " value="Https://dotnet.myget.org/F/dotnet-2-0-0-rtm/api/v3/index.json " />    </packageSources></configuration>

Add System.Data.SqlClient packages, use dotnet Add package or edit csproj.

<project sdk="Microsoft.NET.Sdk">  <PropertyGroup>    <outputtype >Exe</OutputType>    <targetframework>netcoreapp2.  0</TargetFramework>  </PropertyGroup>    <ItemGroup>    <packagereference include="System.Data.SqlClient " version="4.4.0" />  </ItemGroup></Project>

Then restore the package

Then use the VS Code to open the folder for ADO to get the DataTable.

Write the following code:

usingSystem;usingSystem.Data;usingSystem.Data.SqlClient;namespaceadonetdemo{classProgram {Static voidMain (string[] args) {Console.WriteLine ("Hello world!"); stringConnectionString ="Data source=.; database=note;uid=sa;pwd=xxx;"; SqlConnection Conn=NewSqlConnection (connectionString); Conn.            Open (); SqlDataAdapter Adapter=NewSqlDataAdapter ("SELECT * from Notes", conn); DataSet DataSet=NewDataSet ();adapter. Fill (dataset);DataTable dt = DataSet. tables[0]; foreach(varIteminchdt. Rows) {DataRow row=item asDataRow; System.Console.WriteLine (row["Title"]); } System.Console.WriteLine ("This article original Linezero"); }    }}

The results of the run display are as follows:

Mvc

New Project dotnet New MVC

Program.cs has been streamlined as follows:

     Public class program    {        publicstaticvoid Main (string[] args)        {            Buildwebhost (args). Run ();        }          Public Static Iwebhost buildwebhost (string[] args) =            webhost.createdefaultbuilder (args)                . Usestartup<Startup>()                . Build ();    }

Run with dotnet run.

Razor

New Project dotnet New Razor

Directory will find only pages folder, and then only the View page and view of the corresponding CS file, code can also be written on the view page.

Change the index to the following:

     Public class Indexmodel:pagemodel    {        publicstring  Name;          Public void Onget ()        {            Name="linezero Blog";        }    }

Run the program dotnet run:

Developing debugging Projects

This article uses vs Code, version: 1.14.2 C # Plug-in version: 1.12.0

VS Code First use requires that the C # plugin be fully downloaded as follows:

The latest version vs 2017 15.3 should also support. NET Core 2.0.

Select Yes.

This section uses the Adonetdemo project to do a presentation. Direct debugging can refer to the previous article: using vs code to develop debugging from scratch. NET Core 1.1

Debug with additional debugging.

Select. NET Core Attach here to add Console.readkey () to the code, so that the program does not exit temporarily, and then attach.

Click Debug, pay attention to selecting the first, dotnet exec.

Then press any key to start debugging

You can debug and display the information correctly.

Finally, the official release of. NET Core 2.0 Microsoft officially released a period of time, this article does not represent the final. NET Core 2.0 Official edition.

If you think this article is helpful to you, please click " recommend ", thank you.

. NET Core 2.0 and ASP 2.0 official first-edition early-Experience

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.