How to change target framework of a .net core project from netstandard2.1 to netcoreapp3.1 in VS Code

I have a web app solution created on vs code, in which I have 4 project.
One project, named “core.csproj” is targeted framework as: netstandard2.1

All the rest (API.csproj, infrastructure.csproj, emailservice.csproj) are targeted at 3.1 as:
netcoreapp3.1**

Now, I encountered incompatible problem when I tried to add the “core.csproj” as reference project to other projects. Therefore, I wanted to change it. Can anyone please guide how?

The dotnet command I used to add reference project:
dotnet add Core/Core.csproj reference API/API.csproj

The Error I got:
API.csproj cannot be added due to incompatible targeted frameworks between the two projects. Review the project you are trying to add and verify that is compatible with the following targets: – unsupported.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Edit the core.csproj file and change the TargetFramework property to 3.1. and save the file.

Rebuild the solution, if any errors result correct them.

Rebuild again.

Please take a backup of the project before you do change for any unexpected problem risk.

Example here:

How to change target framework of a .net core project from netstandard2.1 to netcoreapp3.1 in VS Code


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x