(This article also published in my public number "dotnet daily Essence article", Welcome to the right QR code to pay attention to. )
Preface: The previous article described some of the changes that were made to the ASP. NET 5 Beta, although the original text gave an introduction to upgrading from BETA4 to Beta5, but it was too brief and vague. I will share my experience with you today.
I upgraded my ASP. NET 5 Project code from beta 4 to beta5 or complied with the basic steps mentioned in the original text of the previous article.
1. Install or upgrade the DNVM.
If you do not have. NET Version Manager (DNVM), you need to install it by using the following code (if you already have the following code will be upgraded to the latest version):
1:"&{$Branch = ' dev '; IEX (New-object net.webclient). Downloadstring (' Https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1 ')} "
Theoretically, executing the above code can install (or upgrade) the DNVM to "beta6-10395", the obvious difference is a more "update-self" command.
If you already have beta4 DNVM, then after executing the above command, you need to restart the command Line window to see the latest version of DNVM; Of course, I also encountered a strange problem, that is, after the implementation of the above code can not upgrade, finally helpless, had to perform the second step (see: Upgrade DNX Runtime) Special steps , and you'll see that DNVM is automatically upgraded to the latest version.
2. Upgrade the DNX runtime.
If DNVM is upgraded normally, you do not need to set the "dnx_feed" environment variable because the default address of the latest version of DNVM is already "https://www.nuget.org/api/v2". Now you can download and install the BETA5 Runtime for ASP. DNVM Upgrade (the default is CLR x86) and automatically set the activation state and default alias for this runtime.
Of course, if you do not upgrade DNVM, you can set "Dnx_feed" and then upgrade the DNX runtime.
You can also do "DNVM Upgrade" without setting "Dnx_feed" to upgrade to BETA5 pre-release (beta5-12103) first. Upgrading to the pre-release version of BETA5 will upgrade DNVM at the same time, then execute "DNVM Upgrade" again to upgrade to the BETA5 official release. (Here are the special steps mentioned above).
3, modify the package reference in Project.json.
Open the Project.json file for all projects in the solution, change the repair of all the suffixes "beta4" to "Beta5", and after saving the Project.json file, vs will automatically update to the latest BETA5 package.
It is important to note that Xunit's related packages are changed to reference the compiled version of Beta5, which is "Xunit": "2.1.0-beta3-build3029", "Xunit.runner.dnx": "2.1.0-beta3-build99".
Configuration-related packages, modified from "Microsoft.Framework.ConfigurationModel" to "Microsoft.Framework.Configuration".
Change the "Interfaces" suffix of the repair to "abstractions".
4. Resolve the code changes. Depending on the update that was mentioned in the previous article, the Change list (HTTPS://GITHUB.COM/ASPNET/ANNOUNCEMENTS/ISSUES?Q=MILESTONE%3A1.0.0-BETA5) is especially broken to modify the code that compiles the problem. The main changes are:
- EF7 's migration modifies the Code interface (from attribute to method), in order to avoid a lot of code modification I am rebuilding migration myself. If you need to modify, see: Https://github.com/aspnet/Announcements/issues/35
- Modify the namespace "Microsoft.Framework.ConfigurationModel" to "Microsoft.Framework.Configuration".
- Iconfiguration.getsubkey modified to Iconfiguration.getconfigurationsection
- _globalimport.cshtml renamed to _viewimports.cshtml, modified VS2015 may report type without reference, ignore (wait for vswebtools update)
- I previously explained the code referred to in the EF Data Migration article "db." Database as Sqlserverdatabase "should be changed to" DB. Database as Relationaldatabase "
- In unit tests, services must be executed explicitly. Addlogging ()
These are some of my experiences in upgrading to BETA5. A puzzled friend can talk to me on the conversation.
ASP. 5 Adventure (4): How to upgrade ASP. NET 5 from BETA4 to Beta5