ASP.NET 5 Updates and other improvements for Web Developers in Visual Studio 2015 CTP 6
It’s time for another Visual Studio 2015 CTP, and with the CTP 6 release in February 2015 you should find a number of improvements that every web developer will enjoy. In this article we’ll review the new features and improvements in ASP.NET 5 and the Visual Studio editor improvements delivered in CTP 6. For a complete list of the ASP.NET 5 runtime improvements check out the release notes on GitHub at https://github.com/aspnet/Home/releases/tag/v1.0.0-beta3. You can download the new Visual Studio CTP 6 from VisualStudio.com.
We’ve organized the New ASP.NET Project dialog a bit. Now, when you want to start a new ASP.NET 5 project, you start by selecting ‘File – New Project – Web – ASP.NET Web Application’ and the below set of project templates are displayed.
Notice that we have added a grouping for the ASP.NET 4.6 templates that you’re probably already familiar with, and the new ASP.NET 5 preview templates. We hope this makes it easier to discern which templates are new in this version and which templates are those you’ve been working with previously.
The Starter Web template has been updated with information about how to get started building ASP.NET applications that can run on Windows, Linux, and OSX. The home page now shows a bootstrap carousel with information about this and a whole lot more:
The new Web API template is introduced in this release, and it omits all of the extra HTML and razor markup that MVC provides so that you can focus on simply writing a solid API. Start here if you want to build an API with static content, or even as a starting point for your next single-page-application.
The new buttons allow you to refresh the contents of the current file, toggle the force flag when running a task, and toggle the verbose flag for a task. In the sample image, we’ve enabled verbose reporting for executing the grunt-bower task in a default ASP.NET project.
You can now easily add references to system assemblies using the Add References dialog, which will make the appropriate modifications to your project.json file:
We are also hard at work to enable support for adding references to user assemblies for a future preview release.
Up until now, all changes to the behavior of a project went through manual updates to the content of the project.json file. There were a few items that could be updated using the Visual Studio user interface, but they were the minority. With this update, we have added configuration options to the project properties window that will allow you to configure the application and the debug time experience.
In the debug properties window we can now define multiple debug profiles that you want to be able to run your web project under. Each profile lets you specify an executable or a command in your project.json file that you could execute. There are separate arguments, environment variables, options to launch a browser, and the ability to pin a specific K run-time to be used with your debug profile.
There are some new updates in the editor for parsing and managing grunt, gulp, bower, and npm configuration files. We are now providing better intellisense support for these file formats as well as enforcing JSON schemas for those tools. With the addition of byte-order-mark processing in these files, you should have no problems transporting them between Windows, Linux, and OSX operating systems.
If you’re like me, you hated having to re-run grunt or gulp tasks each time you changed npm or bower configurations. The project.json file had automatic restore built in for NuGet, so why can’t we have it for bower and npm? Yes… yes you can now have it for bower.json and package.json too. Each time you save these files, we will restore new packages immediately in the background for you.
We know that developers enjoy working with the solution explorer. We’ve made it easier to update and uninstall bower and npm packages in that panel with a pair of new context menu options:
We placed these options where it made sense for developers who have been using Visual Studio for a long time, and are used to being able to remove references from their projects with some mouse gestures in their solution explorer.
The K Package Manager (KPM) tool has been update to rename some of the existing subcommands and to add a couple of new ones:
|Old Name||New Name||Description|
|pack||bundle||Bundle application for deployment|
|build||pack||Build NuGet packages for the project in a given directory|
|–||build||Build assemblies for the project|
|–||packages||Manage local and remote packages folders|
|–||list||Print the dependencies of a given project|
The pack subcommand now matches the pack subcommand for nuget.exe to help avoid confusion. The build subcommand now produces just the raw assemblies without putting them into a package.
The packages and list subcommands are new. You can use the packages subcommand to sync a packages folder with a remote source. The new list subcommand will show you all of the packages your project depends on and which components are bringing in the dependency.
Have you had tasks that you want to be executed during your web site publication process? We’ve added a checkbox in the publish website wizard that will generate a Powershell script that you can customize and use to publish your website:
With that box checked, an script is generated with the name YOUR-PUBLISH-PROFILE-publish.ps1 in the Properties/PublishProfiles folder of your project. You are then welcome to customize this script to your needs, and Visual Studio will use that script when publishing using that profile.
CTP 6 introduces various improvements and new features in the way in which we help you to handle authentication in your ASP.NET projects. Look for a more detailed update in the next days, but just to whet your
- We now have OpenID Connect and OAuth2 bearer token middleware components you can use with ASP.NET 5. We will publish new samples soon. No templates support (yet).
- The ASP.NET 4.6 templates have been updated: the authentication logic they generate is now based on the OWIN middleware and OpenId Connect, instead of Windows Identity Foundation.
- The “Change Authentication” dialog takes better advantage of the built in identity management features in Visual Studio 2015. Furthermore, it enables you to add delegated permissions to your app
- The authentication logic generated via the ASP.NET 4.6 templates is now the same as the one generated by the “Configure Azure AD Authentication…” dialog, allowing you to modify your authentication settings at any time of a project lifetime
This CTP includes the latest implementation of the new System.Net.Http.WinHttpHandler API that was first introduced in ASP.NET 5 CTP 2. This implementation is intended to be faster and more efficient in terms of memory utilization than the existing .NET 4.5.2 framework version.
Developers can leverage this implementation via the familiar System.Net.Http.HttpClient and System.Net.Http.HttpClientHandler APIs (in ASP.NET 5, both of these APIs are built on top of this new implementation) or through the newly designed System.Net.Http.WinHttpHandler API. This new API provides more granular control (than HttpClientHandler) over individual aspects of HTTP such as:
- Automatic decompression
- Handling HTTP Redirects
- SSL server and client certificate authentication
- Managing HTTP cookies
- HTTP proxy settings
- Setting HTTP send and receive timeouts
We encourage you to try out the new API and compare the performance of the new implementation against your existing .NET HTTP implementation. We look forward to hearing your feedback.
The following parts of the WinHttpHandler API that are yet to be implemented –
- Pre-Authentication on an HTTP connection
- Use of a user-specified CookieContainer object for managing HTTP cookies (current implementation uses an internal cookie store)
- Performance measurements and enhancements
The team is actively working on these and will make them available in an upcoming release.
Keep an eye on our Web Development and Tools blog this week as we have a number of articles planned that take a deeper dive on each of these topics. Do you like what you see? Are these improvements going to help you as a Web developer? You can open issues and track our progress on GitHub, or just write back to us in the comments below… we read all of them, and perhaps your feature suggestions will make it into the next release of Visual Studio! Thanks!