This is the seventh (and last) in my series of converting my red-folder.com site over to ASP.Net Core & MVC 6.
The first article looked at creating an empty project.
The second article looked at copying my existing content into place and getting it to run.
The third article look at getting it up into Azure.
The fourth article took a deeper dive into the Gulp pipeline.
The much delayed fifth article added a simple WebApi (and a basic Angular app).
The sixth article adding a database behind the WebApi using Entity Framework 7.
In this, the last of my articles of converting to Asp.Net Core, I’ll look at upgrading from RC1 to RTM.
From what I’ve read there appears to have been quite shift in thinking between RC1, RC2 and RTM – decisions were made that changes the direction quite a bit during that period. This upset many in the community. The final decisions however seem to have been the correct ones – and while there may have been some pain during the transition, it is worth it to get the framework to the right place.
If it is anything like previous incarnations of .Net – then we will live with the decisions made for over the next ten years. Time will ultimately tell if the correct decision was made.
I’m adding this section after having converted it – so, in hindsight …
I probably should have started with a new empty project and copied all the content in – it would have been cleaner.
And I should have used the I Can Has .Net Core site. Really great tool for highlighting dependencies that you need to change.
Ok … back to the stream of consciousness …
Possibly the most time consuming part of the whole process.
The Update can be found here.
I had originally thought this was done by Update 3 – but it didn’t seem to be case so I added separately.
I seemed to suffer from an installer bug which claimed that Update 3 hadn’t been applied – telling me to run a fix.
Following the instructions here I was able to install the tools.
I would expect given time that the tools will be rolled into the Visual Studio updates and it will be relatively automatic. At this stage, the extra step seems a little tedious.
Again, not sure if this is a step that is needed, but seems to be advise to upgrade to 3.5.
I already had 18.104.22.1684 installed, so nothing to do there.
Most of this was based on this article
Where I have previously talked about DNVM (Dot New Version Manager) and DNX (Dotnet Execution Runtime), these have now been replaced by the .Net Core CLI (Command Line Interface).
I’ve had to make the following changes:
This document provides details of references that have changed ().
Json.Net is now defaulting to CamelCase so I could remove the serialiser. The JsonOutputFormatter setup (so the Json response was CamelCase) need to be changed as the this article
Change the ConnectionString format within appsettings.json
This caught me out for a while. Basically I moved it outside of the data node, creating a ConnectionStrings node for the RepoContext.
I found that Migrations was struggling to work – even with all references updated.
In the end I code to completely recreate the migrations with solved the problem.
The [FromServices] DI attribute has changed from being usable with properties to being used only with Action parameters.
Updated the Startup constructor to set the base path.
Replaced the httpPlatformHandler (and it’s config) with apsNetCore handler.
I run gulp tasks on PreBuild (setup in project.json) – or at least I had done.
Took a lot of digging to find that PreBuild had become PreCompile and the corresponding variables had changed as well. Simple enough once you know how, but it took a lot of digging and blind luck that I found it mentioned in a Stackoverflow response.
For reasons that completely escape me, I couldn’t get the project to work on the existing Azure webapp. Creating a new one, published, all good. Very strange.
It kept complaining about permissions when I browsed it (felt like it was trying to serve files directly and telling me that I didn’t have permissions to browser). I suspect the AspNetCore handler wasn’t picking up the requests – but for the life of me I couldn’t see why.
The new webapp solved that problem.
I suspect I’ve missed a few changes in the above (or have in the wrong order).
I’ve been at it for odd stolen minutes over the past couple of weeks. All in all it probably would have taken maybe an hour or two end to end.
In the end, everything has been committed under this commit.
I wanted to have an end to this series. The move to RTM seems the appropriate place to do so.
I suspect that I will provide a updates in the future. I suspect that as I dig deeper into the Asp.Net Core, there will be a number of face palm moments.
But I think I’ll do that in new posts as I get to them (for the next few weeks I’ll be updating the site with content aimed at getting me the next contract role).
A collection of additional links that I used during the process: