c# - Azure Function 引用混合模式程序集

标签 c# azure azure-functions azure-app-service-plans

TL;DR:是否可以在 Azure Functions 中使用混合模式程序集?

详细信息:我有一个内部混合模式程序集,我正在尝试在 Azure 函数中使用它。当我尝试构建时,出现以下错误:

------ Build started: Project: AzureDemo, Configuration: Debug x64 ------
AzureDemo -> C:\src\local\2017\AzureDemo\bin\x64\Debug\net462\bin\AzureDemo.dll
C:\Users\hugh\.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets(31,5): error : Could not load file or assembly 'file:///C:\src\local\2017\AzureDemo\bin\x64\Debug\net462\bin\AzureDemo.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Done building project "AzureDemo.csproj" -- FAILED.

为了清楚起见,内部库是 x64,我的演示项目也是 x64,所以这不是 x86/x64 问题。

此外,当我从 Azure Function 项目中取出代码并将其放入普通的旧 .NET Core 2.0 项目中时,它构建得很好。 编辑:它构建很好,但它仍然无法运行(System.EntryPointNotFoundException:必须在应用于非IJW的DllImport属性中指定库名称方法。)。所以我可能比我想象的更深。

我有点担心 Azure Functions 无法与混合模式程序集一起使用...但我还没有找到任何对此效果的明确声明。

我也有点担心它使用 netstandard1.0 的事实可能与此有关。

最佳答案

当 SDK 启动构建任务以生成构建工件/函数元数据时,错误发生在构建时。

我已打开此问题,其中包含跟踪错误的详细信息:https://github.com/Azure/azure-functions-vs-build-sdk/issues/131

成功的本地测试还需要实际的 x64 CLI 版本,这在此处进行跟踪:https://github.com/Azure/azure-functions-cli/issues/117

关于c# - Azure Function 引用混合模式程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46941171/

相关文章:

Azure DevOps 主体未显示在 Key Vault 中

c# - 使用 ServiceProxy.Create 连接到特定服务实例

windows - Windows Server 2016 TP4上的Docker通过powershell下载容器中的git

c# - 在 Azure Functions 中加载证书时出现运行时错误

c# - Azure函数队列触发器添加Nuget包

c# - 由于curlys进入if语句后进入else语句

c# - CS0117 C# 'Resource' 不包含 'Drawable' 的定义

azure - 端点 Webhook URL 上的事件网格订阅 ARM 部署失败

c# - 在哪里可以找到 Microsoft.Office.Interop.Word.dll (2010)?

c# - 如何在 C# 中使用 Quickbase API 上传文件?