Exploring project.json file In ASP.NET Core Project

This post is a continuation of my previous articles on ASP.NET Core. Please read them here:

The ".csproj" file we find in earlier versions of ASP.NET projects is gone in ASP.NET Core.  Here's what project.json file means to an ASP.NET Core project:
 
 
 
Let's explore project.json file's structure and learn how to use it effectively.  Apart from the default debug and release build configurations built into the runtime, we can specify new build configurations or override debug and release in the project.json by just typing in the JSON. And yes, you have the IntelliSense magic available here as well.
 
That's cool, right! Okay, fair enough. Let's go into details. project.json file together with the project's ".xproj" file is the replacement for the ".csproj" file. I will go one by one. In the below picture, I have numbered them for better identification:

 
 
1.  The top most part depicts the project information. You can specify the version, the title of the application, and the authors and many more. IntelliSense is your Hero!

 
With emitEntryPoint under compilationOptions, we are telling the DNX that this project has an entrypoint in the form of a static Main method that has to be executed. That method is present in the Startup class in startup.cs. 
 
Under dependencies (Section 2), there are the NuGet packages this project uses. Remember that NuGet must now be used for server-side packages only. You can use IntelliSense or you can use the Manage NuGet Packages option by right-clicking on the project. The section will reflect your changes either way! If you open up File Explorer  in the project folder, you won't find the installed NuGet packages in there.

 
 
 
The packages are now managed in a central location. Under your user's folder is a folder called .dnx and a subfolder called packages. All NuGet packages are installed in that folder. It uses sub folders to support versioning so multiple versions of the same package can exist at the same time.

 
 
Commands (Section 3) tell the DNX to execute the app in a certain way and show up in the run section of Visual Studio. IIS Express is a command that Visual Studio manages. But web instructs the DNX to execute the app with the Kestrel web server, which is also a NuGet dependency.

 
 
The frameworks section (Section 4) is specifying for which frameworks you're building the app. Yes, you can now build against multiple frameworks in one go. For example, the demo application is targeting two frameworks right now: The full .NET Framework and the Core.
 
Exclude (Section 5) tells the compiler what directories to exclude from building.
 
And publishExclude (Section 6) excludes certain files from the deployment process.  I assume they're IDE specific,
 
 
There are more settings you could add to configure the compilation process like compile and compileExclude that specify what files to compile using a whitelist, and compileExclude excludes certain files using a blacklist. Time to get your fingers warmed up!
 
Let's see what Startup.cs file holds for the application in the next article.
 
Hope you enjoyed reading. Please share your thoughts and feedback using the comments section. 
 
Read more articles on ASP.NET Core: