Getting .NET Core 2.1 Preview 2 Working with Visual Studio 2017
About a year ago I wanted to start using .NET Framework 4.7, it should have been an easy process, but wasn’t. After some trial and error if figured it out and wrote a blog post explaining how to get it working.
Now with the release of .NET Core 2.1 Preview 2, I have hit the familiar problems - no obvious instructions from Microsoft, no one place to download all everything that needed and a Visual Studio install that does not include what you the latest SDK or runtime, and errors like - The specified framework 'Microsoft.AspNetCore.App', version '2.1.0-preview2-final' was not found.
or, 'dotnet.exe' has exited with code -2147450730 (0x80008096)
.
After a few hours messing around and installing the wrong versions of the right software I figured it out.
Step 1
Install the latest version of Visual Studio Preview https://www.visualstudio.com/vs/preview/, at the time of writing this was version 15.7.0 Preview 4.0
I’m interested in developing Web API applications, so I check that box.
BUT, version 15.7.0 Preview 4.0 comes with .NET Core Version 2.1.0 Preview 1. So you don’t get the fancy new features like HttpClientFactory
. Read on…
Step 2
Go to https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.1.0-preview2-download.md and download the SDK and the Runtime for your architecture.
You can verify the checksum of the downloads if you want to by comparing your SHA sum to these ones - https://dotnetcli.blob.core.windows.net/dotnet/checksums/2.1.300-preview2-008530-sdk-sha.txt
Install both the SDK and the runtime.
Step 3
To verify that that you are running .NET Core Preview 2, open visual studio and create a new .NET Core Web API application.
Once it has been created, open the .csproj file, you should see this block -
1<ItemGroup>
2 <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview2-final" />
3</ItemGroup>
If you don’t see Version="2.1.0-preview2-final"
, something has gone wrong.
You can verify what packages are installed by going to your start menu and opening Apps and Features/Add or remove programs.
If you have installed the right SDK and runtime you should see the following -