我们有一个在 Linux 主机上运行的 Azure 函数。
我们的应用程序是一个netcoreapp3.1
. 它运行良好,除了一个我无法解释的问题。
csproj 文件一直是这样配置的(只是一个片段):
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<UserSecretsId>...</UserSecretsId>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Cloud.Asset.V1" Version="2.6.0" />
</ItemGroup>
还有许多其他软件包,但这个是有问题的软件包。在 Windows 上一切正常,一切正常。在 Linux(或 WSL2)上,该应用程序也可以正常构建,Functions Host 启动并且一切似乎都很好,直到我们找到使用该Google.Cloud.Asset.V1
包的代码。这个包引用Grpc.Core
,然后代码失败
System.Private.CoreLib: Exception while executing function: inventory. Grpc.Core: Error loading native library. Not found in any of the possible locations: /mnt/c/development/app/App.Functions/bin/Debug/netcoreapp3.1/bin/libgrpc_csharp_ext.x64.so,/mnt/c/development/app/App.Functions/bin/Debug/netcoreapp3.1/bin/runtimes/linux/native/libgrpc_csharp_ext.x64.so,/mnt/c/development/app/App.Functions/bin/Debug/netcoreapp3.1/bin/../../runtimes/linux/native/libgrpc_csharp_ext.x64.so.
这对我来说似乎没有意义,因为这曾经可以工作,但csproj
最近没有任何变化,除了添加的其他依赖项,但与此无关。
签入不仅bin/Debug/netcoreapp3.1/bin/runtimes
有linux
Windows。
但是,我确实在这里看到了这个目录,尽管它似乎不在错误消息的搜索路径中。这是bin/Debug/netcoreapp3.1/runtimes
.
有谁知道我怎样才能让它再次工作?
我尝试将<RuntimeIdentifier>
或添加<RuntimeIdentifiers>
到 csproj 中,但这并没有改变任何东西。