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
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
How to fix it?
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>
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With