Here are the steps I took to update a recent project:
- Install the .NET Core 2.2 SDK from https://dotnet.microsoft.com/download/dotnet-core/2.2. The SDK download will also install the runtime.
-
Update the TargetFramework attribute in the project’s .csproj file:
<TargetFramework>netcoreapp2.2</TargetFramework>
-
Run the command line
dotnet list package --outdated
to find which packages might need to be updated. With certain packages, you’re required to update them or the project won’t compiled (iedotnet build
).In my case, I had to update two packages from version 2.1.0 to 2.2.0:<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
Update 12/11/2018: I didn’t even need to include, and therefore update, those two packages since they are included in the Microsoft.AspNetCore.App package.
-
Run the command line
dotnet build
. This command will implicitly run the commanddotnet restore
, which does the actual work of updating the packages, and then it will compile the application. -
Update the correct path to the project’s dll in the .vscode\launch.json file. Since I used Visual Studio Code as my editor, I updated the path to make sure debugging continue to work correctly:
"program": "${workspaceFolder}\\bin\\Debug\\netcoreapp2.2\\ExpenseMgmt.dll"
References:
https://docs.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.2#update-aspnet-core