I have a solution where I use two ".Net Standard 2.1 Class Libraries". In addition to these libraries, I have three more projects, namely:
- ASP.NET Core Web API
- Blazor WebAssembly App
- .NET MAUI App
These three projects make reference to libraries.
I created this solution 2 years ago. As I use Identity in the solution I installed the Microsoft.AspNetCore.Identity package, but this package has been discontinued and marked as "Deprecated" in the NuGet package gallery:
Screenshot of Microsoft.AspNetCore.Identity NuGet package marked as deprecated There are more details about this in the GitHub repository.
I then decided to update the libraries for .NET 8 like all other projects (this solution is not in production yet), but the Microsoft.AspNetCore.Identity package does not exist for .NET Core. In this case it is necessary to add a reference to the Microsoft.AspNetCore.App framework in the project and packages such as Identity will be included: Solution showing the Microsoft.AspNetCore.App framework referenced in the class library project
So far so good. I made the reference and the project compiled without fail.
The problem starts when I try to compile the projects:
Blazor WebAssembly App Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"
C:\Program Files\dotnet\sdk\8.0.100-rc.1.23455.8\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.
targets(485,5): error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIde
ntifier 'browser-wasm'. [C:\...\WebAssembly\WebAssembly.csproj]
.NET MAUI App Project Sdk="Microsoft.NET.Sdk"
C:\Program Files\dotnet\sdk\8.0.100-rc.1.23455.8\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.
targets(485,5): error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIde
ntifier 'ios-arm64'. [C:\...\Mobile.MAUI\Mobile.MAUI.csproj::TargetFramework=net8.0-ios]
C:\Program Files\dotnet\sdk\8.0.100-rc.1.23455.8\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.
targets(485,5): error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIde
ntifier 'android-arm64'. [C:\...\Mobile.MAUI\Mobile.MAUI.csproj::TargetFramework=net8.0-android]
The ASP.NET Core Web API project does not fail because its project sdk is "Microsoft.NET.Sdk.Web" and it contains the runtime necessary to compile the Microsoft.AspNetCore.App framework.
In the WebAssembly project I have already tried changing the project sdk to Microsoft.NET.Sdk.Web
and adding <UseWebAssembly>true</UseWebAssembly>
in the ".csproj" file. The compilation works, but when I run the project it presents an error in the browser console and the website does not load.
One interesting thing I saw was when I ran dotnet build -v diag
and in the log I found this snippet:
Microsoft.AspNetCore.App
TargetFramework = net8.0
DefaultRuntimeFrameworkVersion = 8.0.0-rc.1.23421.29
TargetingPackName = Microsoft.AspNetCore.App.Ref
LatestRuntimeFrameworkVersion = 8.0.0-rc.1.23421.29
RuntimePackExcludedRuntimeIdentifiers = android;linux-bionic
RuntimePackRuntimeIdentifiers = win-x64;win-x86;win-arm;osx-x64;linux-musl-x64;linux-musl-arm64;linux-x64;linux-arm;linux-arm64;linux-musl-arm;win-arm64;osx-arm64;linux-s390x;linux-ppc64le
RuntimePackNamePatterns = Microsoft.AspNetCore.App.Runtime.**RID**
TargetingPackVersion = 8.0.0-rc.1.23421.29
RuntimeFrameworkName = Microsoft.AspNetCore.App
From what I understand, in "RuntimePackRuntimeIdentifiers" the runtimes that can run this framework are specified and this list does not include the three that are mentioned in the error messages above: browser-wasm, ios-arm64 and android-arm64.
dotnet workload install wasm-tools ios android
dotnet workload restore
The commands were executed successfully and the workloads were installed, but the errors persisted.
Another thing I tried to do was include "RuntimeIdentifiers" in the ".csproj" files. I tried it in the library projects and then in the WebAssembly and .NET MAUI projects. That way:
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'aspnetcoreapp'">win-x64</RuntimeIdentifiers>
Unsuccessfully. I ran dotnet build -v diag
on the library project and saw that the framework name is "aspnetcoreapp". So I thought that explicitly indicating which runtime to use for compilation would work, but it failed in exactly the same way. It could also be that I got confused with the name of the framework and put the wrong name.
At the time of writing this text I have been trying to solve it for three days. I've done a lot of research. Lots of them right here on Stack Overflow, but I couldn't find something that worked for me. I could simply go back to .NET Standard 2.1 and keep the Identity NuGet package even deprecated to avoid this problem, but it won't help because at some point I will have to make this correction.
Sorry for the huge text. Any contribution will be very useful!
Edition 1 Right after I made the post, I continued doing research and did something I hadn't thought of before: I accessed the aspnetcore repository on GitHub and searched for "There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier" in the issues section. I found some posts reporting the same problem I had with clarifying answers like these:
- https://github.com/dotnet/aspnetcore/issues/26959#issuecomment-709900451
- https://github.com/dotnet/aspnetcore/issues/46171#issuecomment-1397572319
With these answers it became clear that it is impossible to do what I am trying. Therefore, the only way will be to review the structure of the solution and decouple these projects as the person who responded to this issue did.
I hope this post helps others in the future...