.NET Core 2 build is not working in .NET Core 3.1

674 views Asked by At

All,

I have a build server that has .NET Core 2.2.110 installed in it. For my new application, I need .NET Core 3.1. So I've installed .NET Core 3.1 in addition to .NET Core 2.2.110.

When I hit dotnet --version I get 3.1

The build is working fine when building applications developed in .NET Core 3.1 but it's failing for the below framework applications and giving me the following error

The imported project "C:\Program Files\dotnet\sdk\3.1.100\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found

I have both 2.1 as well as 3.1 on my build machine, technically applications developed by 3.1 should use .NET Core 3.1 f/w, and apps developed by 2.2.110 should use .NET Core 2.2.110.

Also, any upgraded framework should also support previous versioned apps but in my case, it's failing.

Please help me

1

There are 1 answers

0
Chris Hess On

Maybe you can specify the target platform in each project.

Add the line : <PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework>/PropertyGroup> in you .csproj file to compile with .Net 3.1 or netcoreapp2.0 for .Net 2