Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function referencing mixed-mode assembly

TL;DR: Is it possible to use mixed-mode assemblies in Azure Functions?

Details: I have an in-house mixed-mode assembly that I'm trying to use in an Azure Function. When I try to build, I get the following error:

------ 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.

For clarity, the in-house library is x64 and my demo project is also x64, so it's not an x86/x64 problem.

Also, when I take the code out of the Azure Function project and put it in a plain old .NET Core 2.0 project, it builds just fine. edit: it builds fine, but it still doesn't run (System.EntryPointNotFoundException: A library name must be specified in a DllImport attribute applied to non-IJW methods.). So I may be in deeper water than I thought.

I'm kind of afraid Azure Functions won't work with mixed-mode assemblies... but I haven't found any definitive statement to that effect.

I'm also a little concerned that the fact that it's using netstandard1.0 might have something to do with it.

like image 922
Hugh Avatar asked Sep 15 '26 22:09

Hugh


1 Answers

The error is happening at build time when the SDK launches the build task to generate the build artifacts/function metadata.

I've opened this issue with the details to track the bug: https://github.com/Azure/azure-functions-vs-build-sdk/issues/131

Actual x64 CLI releases would also be required for successful local testing, and this is tracked here: https://github.com/Azure/azure-functions-cli/issues/117

like image 174
Fabio Cavalcante Avatar answered Sep 17 '26 13:09

Fabio Cavalcante



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!