.Net Core 1.0 Released!

This came as a little surprise for me, especially that rc2 was released not so long ago, but here it is! .Net Core 1.0 is finally released.

I suppose now I should migrate my rc1 projects to final version, since it's stable now...

Installation

If you don't mind installers, just go to dot.net and download the .Net Core SDK Windows Installer.

Otherwise, if you're a command-line freak, use the dotnet-install.ps1 script (from PowerShell commandline):

> wget https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1 | iex

You don't even need elevated access - by default dotnet will install in %LOCALAPPDATA%\Microsoft\dotnet. The install script also takes optional arguments, such as the required version of dotnet SDK, install location, and so on. If you want to fiddle with these options, just save it locally:

> wget https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1 -outfile dotnet-install.ps1
>  get-help .\dotnet-install.ps1 -Detailed

Let's verify dotnet installation:

> dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version:            1.0.0-preview2-003121
Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
OS Name:     Windows
OS Version:  10.0.10586
OS Platform: Windows
RID:         win10-x64

Cool, now we can get to work.

.Net Core vs .Net Core SDK

If you head to Downloads on dot.net site, you will notice there are two separate components, that are versioned separately:

  • .NET Core = Run apps with .NET Core runtime
  • .NET Core SDK = Develop apps with .NET Core and the SDK+CLI (Software Development Kit/Command Line Interface) tools

This may seem confusing, but think of it this way: .Net Core is like another version of .Net Framework. You need it in order to run applications that target .Net Core (like on the server). .Net Core SDK contains .Net Core plus additional (CLI tooling)[https://github.com/dotnet/cli] - so you can actually develop and compile apps (like on your dev machine).

The dotnet command is still available after .Net Core installation (without the SDK), but if you run it:

> dotnet restore
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
 http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

> dotnet
Microsoft .NET Core Shared Framework Host

Version  : 1.0.1
Build    : cee57bf6c981237d80aa1631cfe83cb9ba329f12

Usage: 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 are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.

To get started on developing applications for .NET Core, install .NET SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

What's in the box?

The dotnet directory layout looks like this:

dotnet
 \- shared/
     \- Microsoft.NETCore.App/
         \- 1.0.0/
             \- *.dll files
             \- corehost.exe
             \- dotnet.exe
             \- .version
             \- Microsoft.NETCore.App.deps.json
 \- sdk/
     \- 1.0.0-preview2-003121
         \- *.dll files
         \- .version
         \- *.deps.json files
         \- hostfxr.dll
         \- corehost.exe
         \- hostpolicy.dll
         \- runtimes/
             \- unix/
             \- win7/
             \- win/
             \- win-x64/
             \- win-x86/
             \- win8-arm/
 \- host
     \- fxr
         \- 1.0.1
             \- hostfxr.dll
 \- dotnet.exe

Something to note:

  • Each directory in runtimes contains only a few runtime-specific dlls.
  • hostfxr.dll - wonder what's this for...

Getting started

dotnet command is announced to be the one which you will ever need to operate in .Net Core space. That is, including creating a new project:

> dotnet new

Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 5206 ms
Expanding 100% 104448 ms
Created new C# project in C:\src\dotnet\test.

That gives us a simple "Hello world" program and a project.json file. Just type dotnet run and...

> dotnet run
The current project is not valid because of the following errors:
C:\src\dotnet\test\project.lock.json(1,0): error NU1009: The expected lock file doesn't exist. Please run "dotnet restore" to generate a new lock file.

Ok, sure, dotnet restore:

> dotnet restore    
log  : Restoring packages for C:\src\dotnet\test\project.json...
log  : Writing lock file to disk. Path: C:\src\dotnet\test\project.lock.json
log  : C:\src\dotnet\test\project.json
log  : Restore completed in 2118ms.

Fine, project.lock.json is created and up to date.

> dotnet run
Project test (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling test for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:03.1092630


Hello World!

Great! Now you can checkout all the resources at https://www.microsoft.com/net and start hacking. And I'm gonna start migrating my RC1 projects to .Net Core 1.0...