Updating Visual Studio 2015 Preview to the latest code bits

It’s 2015 already so let’s get Visual Studio 2015 Preview up to date with the latest NuGet packages and see how to test it. Active development on ASP.NET 5 is going strong but the API is starting to stabilize.

You’ll need the K Version Manger (KVM) installed on your machine for the current user. To install open a command window in admin mode and run the following. Note if you already have the .kre and .kpm sub-directories in your home directory you don’t have to do this step.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"


installkvm

 

 

Create a new ASP.NET Web Application with Visual Studio 2015 Preview.

newproj

 

Choose an empty ASP.NET 5 project.

emptywebapi

Under “TOOLS -> NuGet Package Manager -> Package Manager Settings” make sure you have an entry for the nightly builds as such:

nugetoptions

 

Go the the project.json file and using Intellisense you should be able to pick up the latest version of these packages:

updatingprojectfile

Note that the two nuget packages are classified as rc1, a little step up from beta1. Also I commented out the full framework dependency since I’m really interested in the CoreCLR for the cloud.

"dependencies": {

  "Microsoft.AspNet.Server.IIS": "1.0.0-rc1-10868",

  "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-11927"

},

Save the project file and you should see References brought in as such:

refbroughtin

Ok, let’s update the CORE CLR runtime using this method, right click References and go to Manage NuGet Packages.

Under NightlyBuild source search for KRE and update to latest CoreCLR

latestcoreCLR

This will add the package to your machine which you can now install. Open a cmd window in admin mode and go to \Users\<yourname>\.kpm\packages\KRE-CoreCLR-x86

 

findingtheKRE

cd into the most recent, ‘1.0.0-rc1-10876′ in this case, and run

kvm install KRE-CoreCLR-x86.1.0.0-rc1-10876.nupkg

Your package should now be installed in your .kre directory and you should be able to update your project to use that runtime.

installedkre

 

updateprojprop

 

Modify your Startup.class Configure method like:

public void Configure(IApplicationBuilder app)
{

  app.UseWelcomePage();

}

You should now be able to test by hitting F5 and debugging the app.

Hopefully the Welcome Page is displayed.

welcomescreen

 

You are now running the latest runtime and middleware. Now add the latest MVC framework.

Update your project.json file to include latest mvc bits, remove the KRE runtime if it was added. Remember the latest version may be different by the time you try this:

"dependencies": {

  "Microsoft.AspNet.Server.IIS": "1.0.0-rc1-10868",

  "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-11927",

  "Microsoft.AspNet.Mvc": "6.0.0-rc1-12322"

},

 

Consider yourself updated.