简体   繁体   中英

DotNet MAUI Blazor App build with razor class library (Android/iOS)

Certificate configured as per the guide-line. We are able to generate build without razor class library. When we try to generate build with razor class getting below error.

dotnet\sdk\6.0.400-preview.22301.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResoluti
on.targets(267,5): error NETSDK1005: Assets file '\Razo
rClassLibrary\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that
 you have included 'net6.0-android' in the TargetFrameworks for your project. [C:/RazorClassLibrary\RazorClassLibrary.csproj]

Tried with below options

  1. Removed obj folder
  2. Restore Nuget Package
  3. Visual Studio update
  4. MSBuild update
  5. Added <RuntimeIdentifier>android-arm64</RuntimeIdentifier>

Spending more than two days, Really appreciate any guide to resolve this issue.

I suggest you try this

  1. In Library project.csproj replace TargetFramework by plural -> <TargetFrameworks>net6.0;net6.0-android</TargetFrameworks>
  2. In App project.csproj, I set android to API21, in my case with API31 didn't work.
  3. In App project, right click, properties, Go to Android / Options / Package Sign, and complete complete info from keystore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM