ASP.NET vNext Projects Get Simpler
ASP.NET vNext alpha3 was released along with the Visual Studio "14" CTP3. Several interesting changes are around ASP.NET projects - simpler project files, ability to specify build event handlers, cleaner source folders and more.
A bit of recap - .kproj files were introduced with ASP.NET vNext and Visual Studio 14. Overall, you would see the following files in a barebones ASP.NET vNext application -
- project.json file that holds the build information for the ASP.NET vNext project
- startup class is where you configure the HTTP request pipeline for your application
- .kproj file which is used and maintained by Visual Studio along with the solution (.sln) file. This holds VS specific information such as VSToolsPath and the project GUID. You do not need this file without Visual Studio, for example, when you run the build from command line or if you use other tools to do your development.
The legacy project file formats (such as .csproj or .vbproj) list all the compile and content items in an xml format in a separate section. This allowed Visual Studio to list all the project files in the Solution explorer, without having to check the file system. .kproj files initially followed this format but did not require manually adding files to the project - a file watcher listening to file events would update the project file manually. With CTP3, MS has decided to do away with this altogether - now, if you have a file within your source folder where the .kproj file exists, it is assumed to be included in the project.
One immediate advantage of this is that it avoids conflicts requiring merges when multiple developers add files at the same time. Another advantage is that it is consistent with how the runtime uses these files.
This change also makes .kproj files built with CTP2 incompatible with CTP3. You either need to recreate the .kproj file or manually remove the files listed in it to make existing projects created with VS 14 CTP2 work with CTP3. Read the official announcement for more details on how to do this.
Some other improvements around projects -
- By hooking up pre-defined events in project.json, you can now specify scripts to be invoked at different times such as during Build or Restore
- You can specify the language version, for e.g. to use the experimental version
- The NuGet packages folder has been moved to %userprofile%/.kpm (or $HOME\.kpm on *nix) instead of folder local to the solution. This is flexible and the location can be modified in the global.json file.
- Added Support for specifying configurations
ASP.NET vNext represents a fundamental change to how Microsoft constructs and deploys web frameworks. You can read a quick introduction about some of the changes in our earlier coverage on the topic.