I’m currently in New York City attending the Visual Studio Connect(); event. There’s a lot of excitement in the air for Visual Studio vNext, ASP.NET vNext, and Azure. In my opinion, this is the most impactful change that Microsoft’s Developer Division has made since first introducing .NET. I’ve been following this team closely since the first grumblings of .NET, more specifically ASP.NET. But, this is big. Sure, over the years the team has made cosmetic changes or introduced new functionality. But nothing has touched the foundation of the framework until now.
Today, Microsoft announced that Visual Studio Pro will have a cousin called Visual Studio Community. While both have the same features and functionality, you’ll still pay for the Pro version. The Community version will be free. The Community version is a full fledged product that allows start-ups, students, hobbyists, and open source developers access to the Microsoft tools for free for ever. There’s no time limitation and there’s no catch. All of the details are explained in the EULA. If you have to ask yourself if you need to read it, you probably need to pay for the Pro license.
Also, Microsoft has announced even more items into the open source world. All of these items are available on GitHub. This includes the .NET Framework and complete ASP.NET stack. It also included Entity Framework. All of these teams are open to pull requests. So feel free to make your requests today! To add, ASP.NET will now work cross-platform on Mac and Linux. These capabilities are available due to the strengthened relationship between Microsoft and Xamarin. Be sure to visit http://microsoft.github.io.
How This Impacts Existing ASP.NET Developers
For most current ASP.NET developers, very little will change. ASP.NET 5 is still ASP.NET (minus Web Forms). It’s still C# or VB.NET. It’s still MVC. However, the foundation will be changing. A few of the changes are outlined below.
Global Assembly Cache (GAC)
What more can I say then to say “Goodbye GAC!” Really, that’s exciting. The GAC was the modern day version of DLL hell. This was one piece of baggage that continued to hold back ASP.NET from being a true cross platform technology. The removal does leave behind a gaping hole for enterprises. As of this post, there is no centralized location for binaries in the file system. This means that if you have 105 applications on a box, you’ll have 105 copies of the MVC 6 binaries. I’m sure the team is diligently working on a solution, but it’s not here yet.
One of the core elements of ASP.NET that has been around since the beginning has been configuration. One big change you’ll notice in the new version of the framework is the abandonment of .config files. Instead, the .config files are replaced by JSON files and Startup.cs. To get configuration, you’ll be able to use configuration like the following:
Notice the last line. We’re adding environment variables to our configuration. We can now use environment variables, INI files, JSON files, or XML to update the configuration.
You can also use #IFDEF statements for loading different configuration based on the environment.
If you use config transforms, you can do something relatively close in the new world by adding an environment variable describing the environment. This can be done as a process variable or a machine variable. I’ll most likely post more about this at a later time. But, to show a quick demo, I can update that configuration section like so:
Notice in this update I’m grabbing an environment variable named MyAppEnvironment and adding a new JSON file to my configuration called appsettings.(my variable value).json. This will allow me to have similar functionality to what I have now.
DI is now prevalent in the application pipeline very early on. Microsoft has made DI a first class citizen by implementing their own DI capabilities, but allowing you to use third party such as ninject. We can now use injection within our views as well. So, using the configuration example above, I may want access to configuration that I’ve already imported in my view. In Startup.cs, I’ve made the following changes:
That’s it. I’ve added the Configuration as a singleton. Now in my view, I’ll do the following:
As you can see it’s extremely simple to setup.
NuGet and Packages
With these announcements, Microsoft is also adding in Bower, Grunt, and Gulp support into Visual Studio 2015. If you are developing cross platform, you’ll notice that not all packages are ready for the Core CLR. Some packages are already configured to work such as JSON.net.
There are several other items that have already been discussed on the ASP.NET GitHub page including KVM and KRE. I’d highly recommend checking out that page for more information.
Just sitting in the room as Visual Studio Connect(); I was able to feel the vibe from existing Microsoft developers and from developers using other platforms. I knew this was a big movement, but was surprised to hear from others how big.
What do you think about the announcements from today?