Blazor 웹 어셈블리를 게시할 때 AssemblyResolutionException이 발생합니다.
3575 단어 blazordotnetnetcoreaspnetcore
증상
Visual Studio 및dotnet publish -c Release
에서 게시하면 IL 링커의 빌드 단계에서 다음AssemblyResolutionException
이 발생합니다.
Fatal error in Mono IL Linker
C:\Users\Tomoyo\.nuget\packages\microsoft.aspnetcore.components.webassembly.build\3.2.1\targets\Blazor.MonoRuntime.targets(326,5): error : Unhandled exception. Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535' [C:\Users\Tomoyo\Source\Repos\BlazorApp6\BlazorApp6\BlazorApp6.csproj]
---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
at Mono.Linker.LinkContext.ResolveReferences(AssemblyDefinition assembly)
at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
at Mono.Linker.Steps.LoadReferencesStep.ProcessAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
원인
IL 링커는 모든 종속 어셈블리 참조를 검색하고 불필요한 IL을 트리밍하는 빌드 단계입니다.
종속 어셈블리를 찾는 동안 어셈블리를 찾을 수 없는 경우 예외가 발생하며 일반적으로 NuGet 패키지 참조 어셈블리에서는 발생하지 않습니다.
그러나 패키지 종속성에 따라 예외가 발생할 수 있습니다. 예를 들어, Microsoft.CodeAnalysis.Workspaces
와 같은 패키지를 참조할 때 발생합니다.
그 이유는 Microsoft.CodeAnalysis.Workspaces.Common
가 SQLitePCLRaw.bundle_green
패키지를 PrivateAssets="all"
로 참조하기 때문입니다.
결과적으로 패키지에는 SQLitePCLRaw.bundle_green
에 대한 패키지 참조가 포함되지 않습니다. 따라서 애플리케이션에 패키지를 추가하면 SQLitePCLRaw.bundle_green
패키지는 종속성으로 간주되지 않으며 어셈블리가 포함되지 않습니다.
이 문제는 패키지 종속성으로 처리하지 않지만 어셈블리를 참조하는 상황에서 발생합니다.
해결 방법
이 문제에 대한 두 가지 해결 방법이 있습니다.
1. 프로젝트에서 필요한 패키지를 참조합니다.
누락된 어셈블리가 포함된 패키지를 프로젝트에 추가합니다.
2. IL 링커를 비활성화합니다.
SQLitePCLRaw.bundle_green
와 같은 일부 패키지는 참조를 추가할 때 오류가 발생합니다. 이 경우 IL 링커 자체를 비활성화하십시오.
https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/configure-linker?view=aspnetcore-3.1
<PropertyGroup>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
Reference
이 문제에 관하여(Blazor 웹 어셈블리를 게시할 때 AssemblyResolutionException이 발생합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/mayuki/assemblyresolutionexception-is-thrown-when-publishing-a-blazor-web-assembly-p6o
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Fatal error in Mono IL Linker
C:\Users\Tomoyo\.nuget\packages\microsoft.aspnetcore.components.webassembly.build\3.2.1\targets\Blazor.MonoRuntime.targets(326,5): error : Unhandled exception. Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535' [C:\Users\Tomoyo\Source\Repos\BlazorApp6\BlazorApp6\BlazorApp6.csproj]
---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
at Mono.Linker.LinkContext.ResolveReferences(AssemblyDefinition assembly)
at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences(AssemblyDefinition assembly)
at Mono.Linker.Steps.LoadReferencesStep.ProcessAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
IL 링커는 모든 종속 어셈블리 참조를 검색하고 불필요한 IL을 트리밍하는 빌드 단계입니다.
종속 어셈블리를 찾는 동안 어셈블리를 찾을 수 없는 경우 예외가 발생하며 일반적으로 NuGet 패키지 참조 어셈블리에서는 발생하지 않습니다.
그러나 패키지 종속성에 따라 예외가 발생할 수 있습니다. 예를 들어,
Microsoft.CodeAnalysis.Workspaces
와 같은 패키지를 참조할 때 발생합니다.그 이유는
Microsoft.CodeAnalysis.Workspaces.Common
가 SQLitePCLRaw.bundle_green
패키지를 PrivateAssets="all"
로 참조하기 때문입니다.결과적으로 패키지에는
SQLitePCLRaw.bundle_green
에 대한 패키지 참조가 포함되지 않습니다. 따라서 애플리케이션에 패키지를 추가하면 SQLitePCLRaw.bundle_green
패키지는 종속성으로 간주되지 않으며 어셈블리가 포함되지 않습니다.이 문제는 패키지 종속성으로 처리하지 않지만 어셈블리를 참조하는 상황에서 발생합니다.
해결 방법
이 문제에 대한 두 가지 해결 방법이 있습니다.
1. 프로젝트에서 필요한 패키지를 참조합니다.
누락된 어셈블리가 포함된 패키지를 프로젝트에 추가합니다.
2. IL 링커를 비활성화합니다.
SQLitePCLRaw.bundle_green
와 같은 일부 패키지는 참조를 추가할 때 오류가 발생합니다. 이 경우 IL 링커 자체를 비활성화하십시오.
https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/configure-linker?view=aspnetcore-3.1
<PropertyGroup>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
Reference
이 문제에 관하여(Blazor 웹 어셈블리를 게시할 때 AssemblyResolutionException이 발생합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/mayuki/assemblyresolutionexception-is-thrown-when-publishing-a-blazor-web-assembly-p6o
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
<PropertyGroup>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
Reference
이 문제에 관하여(Blazor 웹 어셈블리를 게시할 때 AssemblyResolutionException이 발생합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/mayuki/assemblyresolutionexception-is-thrown-when-publishing-a-blazor-web-assembly-p6o텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)