Hey, folks, I have been playing around with.NET Core for 1 month and there is still a lot to cover. Though by considering.NET CORE as a sea, which is then further divided into lagoon, lakes, ponds and rivers in the form of ASP.NET MVC, Entity Framework Core, ASP.NET CORE etc., I have no hesitation saying that I just had a few drops of rain over my mind and I felt really good to feel the monsoon coming for .NET developers, where we can see lots of new features coming to the .NET stack cross-platform, with performance benchmarks and open source.NET technologies, which makes Microsoft open to the world. I am a just normal developer, who had no knowledge of open source before, as I never heard from the colleagues or I should say, I was not involved with the community. With .NET being open source now, we have .NET core, which is built from scratch by running cross platforms, and cheap deployment on a a Linux machine, which was not possible before (Note*- Windows Servers are costly compared to Linux Servers). Thus, let's get started by digging into Core. If you want to get started with .NET Core with the steps for downloading SDK my honest suggestion is to go to my previous blog, as mentioned below.

I believe that if you have followed each and every step as mentioned in the blog to start using .NET Core and you are happy to run your basic set of "HelloWorld" programs, which run just fine on Windows, Linux or Mac. Going forward, let's talk about how .NET and .NET Core are different from each other. .NET Core is NuGet based, which means all the dependencies are in the form of NuGet packages, which allow a local app deployment while in.NET Framework, and we have to be dependent upon .NET framework. Every time the new feature is added in the component of .NET Framework, the Microsoft team has to ship the new framework for the same, which results in waiting until a given .NET Framework version is widely adopted. With the help of a NuGet based approach, an Application deploys the new version without waiting for a .NET Framework to be widely accepted resulting in the easy upgrade to the components.
Command line ToolingCommand line Tooling gives us command line features to run and create the ASP.NET or.NET CORE Application with the help of any Text editor. We don't need our own Visual Studio to create and publish Web Applications. All the compiler, runtime and command line toolings are installed in a single go with a single install of SDK. Some .NET Core related commands are given below.
- Dotnet
Once you download the SDK, .NET command will show you the version and help regarding all the related commands, as shown below.
Fig.1. An example of a dotnet version.
- dotnet new
When you install the SDK, .NET command line tools are referenced to the path. In order to create a simple .NET CORE app, we can use .NET new command to scaffold a simple hello world program in (figure 2.)
Fig.2. Creating Console Application using command line- using System;
- namespace ConsoleApplication {
- public class Program {
- public static void Main(string[] args) {
- Console.WriteLine("Hello Saillesh!");
- }
- }
- }
- dotnet restore
Restores all the dependencies defined in the project.json file.
E:\poop>dotnet restore
log : Restoring packages for E:\poop\project.json...
log : Installing runtime.win7.System.Private.Uri 4.3.0.
log : Installing runtime.win7-x64.runtime.native.System.IO.Compression 4.3.0.
log : Installing runtime.win.System.IO.FileSystem 4.3.0.
log : Installing runtime.win.System.Net.Primitives 4.3.0.
log : Installing runtime.win.System.Net.Sockets 4.3.0.
log : Installing runtime.win.Microsoft.Win32.Primitives 4.3.0.
log : Installing runtime.win.System.Console 4.3.0.
log : Installing runtime.win.System.Diagnostics.Debug 4.3.0.
log : Installing runtime.win.System.Runtime.Extensions 4.3.0.
log : Installing runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression 4.3.0
log : Installing runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http 4.3.0.
log : Installing runtime.any.System.Reflection.Extensions 4.3.0.
log : Installing runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security 4.3.0.
log : Writing lock file to disk. Path: E:\poop\project.lock.json
log : E:\poop\project.json
log : Restore completed in 23336ms.
It then creates a project.lock.json, which contains a final list of dependencies, which is relevant to the project.
- dotnet build
It is used to build your Application or compile your Application for an error checking.
- dotnet run
It is used to run your Application when you are done checking or compiling your program.
- dotnet publish
Once you complete your applications, you deploy them to the Web Server to be hosted and serve HTTP requests.
Dotnet publish --framework netcoreapp1.1 --output "E:\poopDel\publish" --configuration debug --no-build. Once I create my console Application and build the same, below are the files I get inside bin-debug folder
Fig.3. Project binaries in .NET Core.
Previously in.NET Framework, we used to have our executable file EXE. In .NET Core, we are not running any EXE in order to run our program; we simply run .NET run in a folder that contains the project.json file because project.json files contain all the instruction and dependencies details for the application. The code of our C# application is compiled into .dll. This DLL is then loaded by .NET runtime loader, which hosts the DLL, when we run .NET run command. There is no mainline exe for the same. We can create a wrapper EXE for frameworks by targeting the runtime as specified below: Set the runtime in Project.json file and run .NET restore.
- "runtimes": {
- "win10-x64": {},
- "win7-x64": {},
- },
When we build the Application, run the command, given below.
dotnet build -r win10-x64

This will generate the wrapper exe file which will in turn run via .NET runtime. We need to ensure that we remove the platform attribute from the project.json file, as shown below.
- "dependencies": {
- "Microsoft.NETCore.App": {
- "version": "1.1.0"
- }
- },
This is done because I am not going to use .NET Core platform, which has been installed and I will use local version. Here is my Project.json with runtimes, to which I am referring







Join the conversation! Your thoughts help the community grow.