Introduction
In this article, I will explain how to install .NET Core tools preview for Visual Studio and how to print “Hello World” in the latest ASP.NET Core 1.0.
Step 1
First download Visual Studio 2015 with Update 3 through the link click here.
Step 2
Go to Install .NET Core tools preview for Visual Studio. This .NET Core tools adds support for .NET Core projects in Visual Studio 2015.

Install DotNet Core
Step 3
This is really interesting. Open Visual Studio 2015 and create new Project.

Open Templates – > Visual C# -> Click .NET Core Category and you can see “ASP.NET Core Web Application” template.

DotnetCore Template in VS 2015

Step 4
Select Empty Templates ( based on your requirement ) in ASP.NET Core Templates Category if you are going to host the app in Microsoft Azure Service and check in the “Host in the cloud option”.

DotNet Core Empty Page

Step 5
Open “Startup.cs” class in “HelloWorldDotnetCore” project folder.



Step 6
We are creating mini middle ware Application, using lambda expression in “app.Run”. This piece of code is creating “Hello World”.
C# Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Hosting;
  7. using Microsoft.AspNetCore.Http;
  8. using Microsoft.Extensions.DependencyInjection;
  9. using Microsoft.Extensions.Logging;
  10. namespace HelloWorldDotnetCore
  11. {
  12. public class Startup
  13. {
  14. // This method gets called by the runtime. Use this method to add services to the container.
  15. // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
  16. public void ConfigureServices(IServiceCollection services)
  17. {
  18. }
  19. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  20. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  21. {
  22. loggerFactory.AddConsole();
  23. if (env.IsDevelopment())
  24. {
  25. app.UseDeveloperExceptionPage();
  26. }
  27. app.Run(async (context) =>
  28. {
  29. await context.Response.WriteAsync(" Hello World! ");
  30. });
  31. }
  32. }
  33. }
Output 1
Step 7
“app.run” doesn’t work in .NET Core followed by using “app.Use”. It will pass two parameters and add the next middleware content In .NET Core.
C# Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Hosting;
  7. using Microsoft.AspNetCore.Http;
  8. using Microsoft.Extensions.DependencyInjection;
  9. using Microsoft.Extensions.Logging;
  10. namespace HelloWorldDotnetCore
  11. {
  12. public class Startup
  13. {
  14. // This method gets called by the runtime. Use this method to add services to the container.
  15. // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
  16. public void ConfigureServices(IServiceCollection services)
  17. {
  18. }
  19. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  20. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  21. {
  22. loggerFactory.AddConsole();
  23. if (env.IsDevelopment())
  24. {
  25. app.UseDeveloperExceptionPage();
  26. }
  27. app.Use(async (context, next) =>
  28. {
  29. await context.Response.WriteAsync("Hello World!!");
  30. await next();
  31. });
  32. app.Run(async (context) =>
  33. {
  34. await context.Response.WriteAsync(" Welcome to Dotnet Core ");
  35. });
  36. }
  37. }
  38. }
Output 2
Reference
Conclusion
We learned how to Install .NET Core tools preview for Visual Studio and how to print “Hello World” in the latest ASP.NET Core 1.0.