6

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?

Henk Holterman
  • 236,989
  • 28
  • 287
  • 464
Do Nhu Vy
  • 33,131
  • 37
  • 143
  • 202

2 Answers2

5

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>
Brandon Minnick
  • 11,396
  • 12
  • 55
  • 108
2

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

Wayne Davis
  • 174
  • 4