The World’s Largest Online Community for Developers
I have a solution with 5 .NET Core 3.1 projects in Visual Studio 2019 16.4.3 with the following structure and references:
MyProject.Core (Class Library)
MyProject.Infrastructure (Class Library)
MyProject.SharedKernel (Class Library)
MyProject.Function (Azure Function v3 Class Library)
MyProject.Web (ASP.NET Core 3.1)
From MyProject.Web I am able to use the EnsureThat library with no issues because if references MyProject.SharedKernel which in turn has the reference to the EnsureThat NuGet package. For some reason, I am unable to do the same in the MyProject.Function project even though it has the exact same reference to MyProject.SharedKernel.
Is there something about an azure function class library that prevents transitive references from working properly? I would prefer not to have to also install the EnsureThat NuGet package in the MyProject.Function project directly.
Unfortunately, what you want is impossible. This is no matter with VS 2019, the reason is this feature has not yet been implemented.
Azure Function can not reference Class Library now. But you can reference the dll file of your class library, the means you can make an output in your SharedKernel Class library and get the output in your azure function.
First, build the SharedKernel Class library, then reference to the dll of this.
In your azure function:
By the way, you can only use the output, using
Ensure That package is still impossible. You need to install it in your azure function.
Hope it helps.