cloudscribe/Announcements

Updating to netcoreapp2.1

Closed this issue · 1 comments

The latest cloudscribe nuget packages are compatible with both netcoreapp2.0 and netcoreapp2.1

Here I will provide some notes for updating and existing app to netcoreapp2.1.

Note I created an app with the latest version of our project template for Visual Studio. Older apps may need additional changes.

  1. Make sure you have the latest cloudscribe nugets

  2. Edit the .csproj file of the web app

  3. Change the target framework to netcoreapp2.1

     <TargetFramework>netcoreapp2.1</TargetFramework>
    
  4. Change the package reference for Microsoft.AspNetCore.All to Microsoft.AspNetCore.App and remove the version:

     <PackageReference Include="Microsoft.AspNetCore.App" />
    
  5. Update the Microsoft.VisualStudio.Web.CodeGeneration.Design package to 2.1

     <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.*" />
    
  6. Remove the following package references:

     <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.*" />
     <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.*" />
     <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.*" />
     <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.*" />
    
  7. In the Config/RoutingAndMvc.cs file (or in Startup for older projects, append this to the end of services.AddMvc() chain

     .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
    

Caveats

For older projects there may be more packages that need to update from 2.0.x to 2.1.0

Note that as of the time of this writing I have not tested updating to Entity Framework Core 2.1 so I would hold off for now on updating that. I will update this issue after I get to testing that.

Currently we still use embedded views, 2.1 makes it possible to pre-compile views in class library projects. I plan to work on new class libraries for pre-compiled views but that will only be compatible with 2.1 apps whereas the rest of the cloudscribe libraries depend on aspnet core 2.0 or higher and can work with either 2.0 or 2.1. So I will leave the existing libraries with embedded views alone to remain compatible with 2.0, but plan to ship new view libraries with different names to support pre-compiled views.

I tested adding these directly to the web app

    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.*" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.*" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.*" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.*" />

which should force use of EFCore 2.1 since the nugets depend on >=2.0

Not seeing any errors.