dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

FrameworkReference 'Microsoft.AspNetCore.App' was not recognized after downgrade #3760

Open syndicatedshannon opened 5 years ago

syndicatedshannon commented 5 years ago

Downgrade TargetFramework from netcoreapp3.0 to netcoreapp2.2 causes the following upon build:

The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized

Clean/Rebuild All does not resolve. Deleting bin/obj folders in the specific projects reporting the FrameworkReference error does resolve. This causes unexpected failures when switching branches. Note the project also depends upon .NET Standard 2.1/2.0 projects, which have coincident upgrade/downgrades. However, cleaning those projects did not resolve.

I can repro and try deleting something specific if it will help pin the problem down further.

RobBowman commented 5 years ago

I'm seeing the same problem but deleting the bin/obj folders has not helped.

syndicatedshannon commented 5 years ago

@RobBowman Just to clarify, in my scenario deleting the depended projects output bin/obj did not work, deleting the dependent did.

RobBowman commented 5 years ago

@syndicatedshannon thanks but I tried deleting all bin and obj folder of all projects depending on - made no difference. I've since create a new empty console solution and hit same problem: https://github.com/dotnet/sdk/issues/3769

syndicatedshannon commented 5 years ago

@RobBowman In my case, I had completely reverted my project to a prior building version and still received the error, until I manually cleaned intermediate and output. However, I can't recall offhand what references changed between the versions. Is it possible you have two issues, one being the issue I ran into, and another being something you didn't revert?

edit: I mean, like are you testing this with manual edits, rather than an RCS? If RCS, you might want to try a fresh/separate checkout of that commit.

RobBowman commented 5 years ago

@syndicatedshannon please see: https://stackoverflow.com/questions/58509531/downgrade-from-core-3-to-2-then-microsoft-aspnetcore-app-not-recognised#58509560 . For 2.2 needs to be rather than FrameworkReference

syndicatedshannon commented 5 years ago

Yeah, that's the kind of thing I meant. That won't have happened in my case where I reverted, unless there was something left behind in intermediates that clean didn't handle.