19

I see that applications that reference the Microsoft.AspNetCore.App framework (AKA ASP.NET Core 3.0) uses types from the assembly Microsoft.AspNetCore.Mvc.Abstractions, Version=3.0.0.0,

enter image description here

But I can't find a NuGet package with same version 3.0.0. How should I reference packages now? E.g. if I want to override ControlBase, how should I reference the Microsoft.AspNetCore.Mvc.Core, Version=3.0.0.0 assembly if there are no such package versions on NuGet?

After adding the following:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

I have another kind of waning:

enter image description here

Which gives the error:

NETSDK1073: The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized Routines.AspNetCore C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 263

Unloading and reloading the application doesn't help.

The same problem occurs in an empty new project:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
</Project>

Compilation

1>------ Rebuild All started: Project: ClassLibrary1, Configuration: Debug Any CPU ------

1>C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(263,5): error NETSDK1073: The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized 1>Done building project "ClassLibrary1.csproj" -- FAILED. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

1 Answer 1

20

You need to add a FrameworkReference to your csproj

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

See Migrate from ASP.NET Core 2.2 to 3.0 for more details

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you... Why I can't reference the only one assembly? I would like to understand the architects motivation....
And it doesn't work at least in my case. TargetFramework>netstandard2.1</TargetFramework> checked, no other libs. Even in new empty C# library (netstandard2.1 of course).
It might be due to asp.net core 3 requiring .net core 3, and not netstandard. When I change my target framework to netcoreapp3.0, and add the FrameworkReference, it all works.
they wrote in netstadard2.1 subset (what can be platform dependent in Microsoft.AspNetCore.Mvc.Abstractions ?) and then publish it exclusively netcoreapp3.0 .. there are not limits for MS architects willfulness.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.