gpt4 book ai didi

visual-studio - 无法评估扩展元数据的 'Cosmos.CRTCompat.dll'。异常消息: Bad IL format

转载 作者:行者123 更新时间:2023-12-04 14:15:22 35 4
gpt4 key购买 nike

我在 Visual Studio 2019 中发布 azure 函数时收到以下警告。

Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format. Could not evaluate 'Microsoft.Azure.Documents.ServiceInterop.dll' for extension metadata. Exception message: Bad IL format.

我在一个空白项目中尝试了相同的操作,但出现了相同的警告。

我在 VS Code 中看到同样的问题

C:\Users\pankaj.ra.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.5\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(63,5): warning : Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format.

我的函数项目文件

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="4.1.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.5" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>

最佳答案

由于您在空白项目中遇到相同的错误,因此该问题很难解决。我创建了一个空白函数并在本地和 azure 中运行良好。

首先,清理所有 nuget 缓存(本地和全局)并恢复所有内容。

dotnet nuget locals all --clear

这很可能是因为处理器架构不匹配:例如,在使用 32 位时加载 64 位程序集会导致此情况

If your application uses 32-bit components, make sure that it always runs as a 32-bit application.
Make sure that you are not using a component that was created with a different version of the .NET Framework.
Make sure that the file image is a valid managed assembly or module.

并且,就列表中的第一项而言:

If the Platform target property for your application project is set to AnyCPU, the compiled application can be run in either 64-bit or 32-bit mode. When it runs as a 64-bit application, the just-in-time (JIT) compiler produces 64-bit native code. If the application depends on a 32-bit managed or unmanaged component, that component will fail to load in 64-bit mode. To correct this problem, set the project's Platform target property to x86 and recompile.

更多详情可以引用这个article .

关于visual-studio - 无法评估扩展元数据的 'Cosmos.CRTCompat.dll'。异常消息: Bad IL format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60757880/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com