Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I use .NET Core 5.0.100-preview.7.20366.6 , Blazor webassembly, Microsoft Visual Studio Community 2019 Preview Version 16.7.0 Preview 6.0

enter image description here

file foo.csproj

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

    <PropertyGroup>
        <TargetFramework>net5.0</TargetFramework>
        <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
        <UseBlazorWebAssembly>true</UseBlazorWebAssembly>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="DevExpress.Blazor" Version="20.1.5" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0-preview.7.20365.19" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0-preview.7.20365.19" PrivateAssets="all" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.0-preview.7.20365.19" />
        <PackageReference Include="System.Net.Http.Json" Version="5.0.0-preview.7.20364.11" />
    </ItemGroup>

</Project>

When press F5 to run debug:

Error

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

enter image description here

How to fix it?

like image 246
Do Nhu Vy Avatar asked Jul 31 '20 13:07

Do Nhu Vy


2 Answers

For .NET Core 3.1 apps, adding <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks> to the .csproj file will prevent this error:

<PropertyGroup>
  <TargetFramework>netcoreapp3.1</TargetFramework>
  <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup>
like image 197
Brandon Minnick Avatar answered Oct 19 '22 23:10

Brandon Minnick


I just resolved the same issue with this process:

-Close the project

-Delete the bin and obj folders in the Blazor.Client project

-Reopen the project

-Open Nuget Console: Tools -> Nuget Package Manager -> Nuget Package Manager Console

-Enter dotnet restore in the command line

After that I hit F5 and the project compiled, and started

like image 20
Wayne Davis Avatar answered Oct 19 '22 22:10

Wayne Davis