Build/Test Issues

.NET Core 3.1 - The FrameworkReference 'Microsoft.NETCore.App' was not recognized

Started by mattyboy on 5,570 views

Today I upgraded my .NET Core 2.2 application to 3.1. My solution builds fine in Visual Studio but NCrunch fails to compile my application.

..\..\..\..\..\..\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets (283, 5): The FrameworkReference 'Microsoft.NETCore.App' was not recognized
..\..\..\..\..\..\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets (283, 5): The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized

External image

PS. I did not explicitly install the .NET 3.1 SDK, it is automatically included in Visual Studio 2019 16.4.1.

Matt
Hi!

Thanks for posting. We are currently looking into this.

Could you confirm this project is using the Swashbuckle.AspNetCore.Filters package?

Michael
Hi Michael

Yes, it is using that package. In fact, I am the author of that package! Is there something wrong with it?

Matt
Hmm, so before I opened this thread I thought I'd try rebooting my laptop "just in case", but NCrunch still didn't work.

But now, when I booted up my laptop again and opened the solution, NCrunch is happy and works. Not sure why.

Happy to close this for now... maybe there is an issue when people are following the upgrade path for the first time?

e.g. today I
1. opened up VS 2019 16.3.something
2. opened my .NET Core 2.2 solution
3. upgraded VS to 16.4.1 which also installed the .NET Core SDK 3.1
4. reopened VS, migrated my solution to .NET Core 3.1. NCrunch failed with the above error.
5. Rebooted my laptop, opened solution again, NCrunch still failed to build.
6. Shutdown laptop
7. Booted laptop, opened solution again, NCrunch happy now.

Good luck trying to reproduce that haha!

Matt

Edited

mattyboy wrote:Hi Michael

Yes, it is using that package. In fact, I am the author of that package! Is there something wrong with it?

Matt



Thanks for confirming this. We have been able to reproduce this consistently.

The package does something which works when building the software from within Visual Studio but not under NCrunch.

On this line an explicit reference to the framework is added. With aspnetcore 3 MS added the concept of transitive references. From what I can see this normal FrameworkReference was added in the package during the preview phase. Maybe not everything was working as expected then. I haven't looked very deep into this, but I don't believe this is a recommended practice.

To bring NCrunch in line with how VS handles these added references we will now detect these explicitly defined FrameworkReferences and when we detect them we will no longer copy the transitive references discovered during the analysis.

Thanks for the help and bug reports, this is very much appreciated :)

The release that fixes this issue is live: https://www.ncrunch.net/download.

Post a reply

Log in to reply.