How do I reference a "Portable" .NET assembly from an Azure Cloud Function?

时间:2016-07-11 19:04:47

标签: c# azure azure-functions

I've successfully referenced an assembly via Nuget and project.json that is a "Portable" assembly. All my code compiles in the Azure function, but when it's run I get:

Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.

As I understand it this is the portable version of System.Net, and Azure only preinstalls the 4.6 version of System.Net.

How do I work around this?

1 个答案:

答案 0 :(得分:3)

这是由当前Azure功能主机里程碑上已解决的错误引起的,并将在下一个版本中部署(可能在本周末)。您可以在此处找到有关该问题及其解决方案的更多信息:https://github.com/Azure/azure-webjobs-sdk-script/issues/478

与此同时,解决方法是将System.Net从Framework文件夹复制到函数文件夹内的bin文件夹中。主机将自动将其解析为私有程序集。

相关问题