简体   繁体   中英

Azure function doesn't automatically load nuget assemblies

I have created nuget package with my custom assembly. It install just fine, but the assemblies are not loaded by the function run time as it should according to the documentation

When you upload a project.json file, the runtime gets the packages and automatically adds references to the package assemblies. You don't need to add #r "AssemblyName" directives. Just add the required using statements to your run.csx file to use the types defined in the NuGet packages.

Thus any using statement including namespaces from my package will just make the function unable to compile.

The assembly is targeting .net 4.6.1 is that a problem I can read that functions only support 4.6 in for the project json.

I can get the assembly to load if I reference it using #r "......\\data\\Functions\\packages\\nuget\\letsencrypt.azure.core\\0.6.16-prerelease\\lib\\net461\\LetsEncrypt.SiteExtension.Core.dll"

This however just leads to all the other dependencies coming from nuget to also be missing. Can it really be true that I have to manually reference every single nuget for it to work?

Turns out it is a problem if you target 4.6.1. It seems to be working now when I changed it to 4.6.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM