Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Change target framework from 4.6.1 to Core 2.1 afterwards #5747


User avatar
0
kpmg created

Hi everyone! We downloaded by mistake a project with .NET 4.6.1 as framework. Unfortunately, we need to have the application on .NET Core 2. Is there a way to manipulate our solution that the target framework is .NET Core 2.1 instead? Thanks in advance! Christian


3 Answer(s)
  • User Avatar
    1
    aaron created
    Support Team

    Duplicate of https://support.aspnetzero.com/QA/Questions/4431:

    For the most part, you can just change the <TargetFramework> in .csproj files from net461 to netcoreapp2.0.

    It's better to download a new project with .NET Core 2.1 as framework, with the same name.

  • User Avatar
    0
    kpmg created

    Hi Aaron!

    Thank you for you answer. I changed all the targetframework attributes and it almost worked out. The problem was SignalR that I had to also adjust to the .Net Core template.

    So I adjusted a bunch of classes that I fortunately did not change since the project start. But now after all the changes I stuck during the startup on an error:

    ‘MyProject.Web.Chat.SignalR.SignalRChatCommunicator' is waiting for the following dependencies:

    • Service 'Microsoft.AspNetCore.SignalR.IHubContext`1[[MyProject.Web.Chat.SignalR.ChatHub, MyProject.Web.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.’ Do you know where I can register the IHubContext? I could not find the place in a blank .Net Core project where that is done.

    Thanks a lot!

  • User Avatar
    0
    aaron created
    Support Team

    Check that you have this line in Startup.cs:

    routes.MapHub<ChatHub>("/signalr-chat");