It bothers me. I realized that DNX and the .NET Core CLI were just tools for running .NET Core applications. If it's just a tool, why does switching from one to another require code changes?
DNVM / DNU / DNX was not just a tool. DNX was also a runtime. He was responsible for loading the CLR and invoking your application. It also meant that he had a lot of information about runtime and application, such as dependencies, environment, etc. This information was available to the application through various services that you could enter, such as IRuntimeEnvironment , IApplicationEnvironment and ILibraryManager .
In turn, MVC has a service called IAssemblyProvider . This is responsible for providing assemblies where MVC should, in particular, look for controllers. By default, this was based on ILibraryManager , which is a DNX-specific service. This means that it will no longer work if you switch to a dotnet-based runtime that is bundled in packages, instead of using a separate tool such as DNVM.
To fix this, the MVC team first began to work based on DNX services and a newer, more targeted alternative ( Microsoft.Extensions.DependencyModel ). You can see the code here . It basically checks if the DNX-specific ILibraryManager , and if not, it returns to the alternative dotnet-API.
The problem with this approach is that it adds extra and in most cases redundant dependencies ( Microsoft.Extensions.PlatformAbstractions.Dnx ) to MVC when most people start using it with dotnet tools and runtimes. Remember; DNX etc. It remains beta and RTM will be released.
Instead, they chose the current solution; have a separate package Microsoft.AspNetCore.Mvc.Dnx , which contains, among other things, a DNX-based IAssemblyProvider for MVC. You can see what the AddMvcDnx method does here .
This means that the few people who follow the pre-release versions will have to make some changes to their code in order to still work in DNX (although I would move to dotnet ASAP), while new people will only need to call AddMvc , as usual.
I hope some of them made sense. This can be really confusing :)