ExtCore icon indicating copy to clipboard operation
ExtCore copied to clipboard

How to use ExtCore with Azure Functions?

Open gpeipman opened this issue 4 years ago • 6 comments

Hi,

is there any chance to use ExtCore with Azure Functions? If I use services.AddExtCore() in functions startup then all I get back is error: System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.'

gpeipman avatar Nov 06 '20 11:11 gpeipman

Hello @gpeipman, I think it's due to a bad restore on azure. Here you can see what package need this dependency https://www.nuget.org/packages/Microsoft.Extensions.DependencyModel/ (section used by)

Even if you are not using ExtCore, this dependency comes via one of 5 packages including Microsoft.AspNetCore.Mvc.Core

Xarkam avatar Nov 18 '20 10:11 Xarkam

You might have a mismatch in your framework versions. Make sure you're running the app in dotnet version >= the version you're testing on.

abdusco avatar Nov 18 '20 20:11 abdusco

Yes, look your package version and pay attention to the sdk used on azure. The default sdk becomes NET 5. Be sure to specify the maximum sdk 3.1 in your Azure pipeline.

Xarkam avatar Nov 19 '20 14:11 Xarkam

I got rid of it. There are actually some more issues. ExtCore is trying to log something during Startup. It's not supported by functions Startup as loggers are initialized and configured partially when configuring methods are called. Therefore all logging during Startup crashes. I got rid of it by implementing my own AddExtCore method.

gpeipman avatar Nov 20 '20 04:11 gpeipman

@gpeipman Do you still have logs of this problem that we can analyze?

Xarkam avatar Nov 20 '20 07:11 Xarkam

Hi @gpeipman, thank you for the information. I didn't think about the Azure Functions while ExtCore development. It would be amazing if you find time to write some simple TODO in the docs... And please let me know if I need to add something to the ExtCore to make it easier to have this use case working with no problems.

BTW, I've released version 6.0.0-beta1, it is based on .NET 5.0.

DmitrySikorsky avatar Nov 22 '20 19:11 DmitrySikorsky