It's been a half dozen years since I started a new project in Visual Studio. I was a little excited at the prospect. I like learning things and I know a lot about almost all the rest of the internet development topics.
I looked up the latest stuff and it turns out that we have a new Visual Studio and a new .NET that have taken a lot of good lessons from the rest of the world of web development. .NET 5 is out of beta and into Release Candidate 1. That's good enough for me. I expect the bugs will be small.
Wait. It's Microsoft and everything they do is stupid.
Problem Zero (which I won't detail)
I
actually went through fits trying to get it all installed and looking
good, but, having done that, I create a new project: ASP Web
Application/ASP.NET 5 Web Application.
Problem One:
I have to do this twice. I keep code on an external drive that the file dialog navigates to as //psf.stuff... . It tells me I that "UNC paths are not supported." The second time, I typed (not navigate) the volume letter, "X:", and it worked.
Problem Two:
I
build the solution. I get a bazillion (well, 204) errors. The first one
tells me that "The type or namespace name 'Identity' does not exist in
the namespace "Microsoft.AspNet'". Another, "The type or namesspace name
'AspNet' does not exist in the namespace 'Microsoft'". Can you imagine?
The
project listed in the first error says "TestProject.DNX 4.5.1,
TestProject.DNX Core 5.0" (obviously, the 'TestProject' is my project
name). For the second one, it's "DNX 4.5.1" only.
I try using
Nuget to add "Identity.Core" and it changes things. I screw around with
that for awhile as new missing references appear until I start getting
messages telling me that I have duplicate definitions. This is truly
awful. (Did I mention that Microsoft always does it stupid? The package
manager doesn't make sure the references are correct? Really?)
Problem Three:
I
start over and this time I decide that I'm working toward .NET 5.0 so
to hell with 4.5.1. I edit the project.json file and remove it. Build
takes forever and I pretty much expect everything will blow up but
instead, I get a message, "Dependencies in project.json were modified.
Please run "dnu restore" to generate a new lock file."
This
feels like progress. I right-click on the project, choose Open Command
Line and type "dnu restore". It works. I return to VS and build again.
It instantly repeats the exact same message. I delete the lock file and
restore it. Same thing. A complete, stupid dead end.
THE SOLUTION (and a lesson is the complete depth of Microsoft stupidity)
I reverse the order of the references to 4.5.1 and 5.0 so that 5.0 comes first. IE,
I change from this:
to this:
The build succeeds promptly. Clicking the IIS Express button opens a web browser and shows me the scaffold web page.
This has taken me over 2.5 hours. Certainly, my inexperience with this technology made it slower. Someone better might have done it more quickly. However, this is the scaffold. This is the part that supposed to save time. This is an epic fail on Microsoft's part. I mean, they put the dependencies in the scaffold in the wrong order!!
The good news is that, if I got enough Google-friendly text in this page, you might have found it well before 2.5 hours elapsed.
Of course, that just means you need to endure Microsoft's next awful surprise. Good luck. I know I need some.