In my last post I created vNext console application using command line tools but now since Microsoft has released CTP version of Visual Studio "14", I would like to re-create the same console application.
Step: Create new vNext console application project
In Visual Studio "14" CTP, click "New Project…" from Start Page.
One interesting thing to note here, is that even though it is a console application, it is categorized in Visual C# > Web project templates and template name also says that it is ASP.NET vNext Console Application. I think they will move it to correct location in next releases.
Pressing OK button with default settings starts creating new project. If it is first ASP.NET vNext console application, it will download the console application related packages from NuGet, such as System.Console, System.IO and so on. Package Manager Log in Output window lists all packages that are either downloaded from NuGet or opened from local disk.
After dependency packages are loaded, it displays following file structure in Solution Explorer:
It can be seen that it only has two files in the project Program.cs, which is same as Program.cs found in .Net Console application and a new project.json file.
Following is the project.json file created by project template:
It is the first file, Runtime looks for, in the project directory to compile and run the application. It contains application metadata, dependencies and supported commands.
Dependencies section lists all the dependencies of the application. At minimum it defines name and version of the dependency and doesn't specify any other information about the location of the package. Runtime loaders determines the location of the package, which could be a NuGet package, source code on local disk or a compiled package.
Configurations section specify the runtime for which it needs to build application. The above project.json will build for net45 (Desktop) and k10 (Core CLR) runtime.
For more details, you can see https://github.com/aspnet/Home/wiki/Project.json-file
Following is the Program.cs file, generated by project template:
By default, it imports only System namespace unlike to regular .Net console application which adds System, System.Collections.Generic, System.Linq, System.Text and System.Threading.Tasks. The reason for that is that in regular .Net console application all these namespaces are part of core
Step Press F5 to run the application
On pressing F5 key, it runs the console application:
Yes, it is only two step process to create Hello World console application in Visual Studio "14" CTP. So it was that easy, but purpose of this blog post was to get an experience of how Visual Studio "14' CTP creates new vNext console applications.