How to fix Severity Code Description Project File Line Suppression State Error NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'maccatalyst-x64'. App C:\Program Files\dotnet\sdk\8.0.100\Sdks\

Anonymous
2023-12-07T15:07:08.92+00:00
  1. Create MAUI Blazor Hybrid App
  2. Create Razor Class Library
  3. Reference Razor Class Library from MAUI Blazor Hybrid App
  4. The error occurs

Severity Code Description Project File Line Suppression State

Error NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'maccatalyst-x64'. App C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 491

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2023-12-08T06:05:02.4+00:00

    Hello,

    According to the development team's answer from There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'android-arm64 #17725, the Razor Class Library is not fully compatible with MAUI, which causes this issue.

    As you discovered, Microsoft.AspNetCore.App cannot be used from within a .NET MAUI app (in most cases) because it requires features not supported in .NET MAUI. That also means that features such as @attribute [RenderModeServer] are not compatible with .NET MAUI because there is no such thing as "server rendering" in a .NET MAUI app. In general, the guidance is to place common cross-platform Razor Components in a Razor Class Library (RCL) project, and then each app project, such as .NET MAUI, ASP.NET, etc. can add anything it needs for specific platforms to be supported. So for the Index.razor file I would suggest putting most of the logic in some common IndexContent.razor file that doesn't specify @attribute [RenderModeServer], and then in the ASP.NET app's Index.razor you can specify the attribute and also render <IndexContent />. There are of course many other ways to do this, but the idea is the same: have platform-independent content in the RCL, and then each platform "customizes" it for the needs of each platform.

    Based on the answers in How to use Razor Component Library with .Net MAUI #6194, you can encapsulate the required component to the MAUI class library and reference it.

    What we currently recommend is that you put your Razor views, etc inside a Razor Class Library. And consume that from either a Maui Class Library or a Maui Application. If you need per-platform functionality, we recommend you define an interface for that functionality to use in Blazor and provide the implementations in a consuming Maui Class Library.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.