我正在使用Azure Functions并希望编写可读取/写入Dynamics CRM的代码。我将CRM SDK DLL(所有这些)添加到bin文件夹中。
一些代码行位于
之下r"D:\home\site\wwwroot\TimerTriggerDaily\bin\Work365.Microsoft.Store.PatnerCenter.Manager.dll"
r"D:\home\site\wwwroot\TimerTriggerDaily\bin\Microsoft.Xrm.Tooling.PackageDeployment.CrmPackageExtentionBase.dll"
r"D:\home\site\wwwroot\TimerTriggerDaily\bin\Microsoft.Crm.Sdk.Proxy.dll"
using Microsoft.Crm.Sdk.Proxy;
运行该功能时出现此错误:
Exception while executing function: Functions.CrmTest1.
mscorlib: Exception has been thrown by the target of an invocation. Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
2017-06-13T06:07:58.840 Function started (Id=fb308e51-5e92-4405-8915-2ad34fd5505f)
2017-06-13T06:07:58.840 Function compilation error
2017-06-13T06:07:58.840 (29,25): error CS0234: The type or namespace name 'Proxy' does not exist in the namespace 'Microsoft.Crm.Sdk' (are you missing an assembly reference?)
2017-06-13T06:07:58.840 Function completed (Failure, Id=fb308e51-5e92-4405-8915-2ad34fd5505f, Duration=1ms)
2017-06-13T06:07:58.871 Exception while executing function: Functions.TimerTriggerDaily. Microsoft.Azure.WebJobs.Script: Script compilation failed.
答案 0 :(得分:1)
您需要在右侧窗格中创建一个project.json文件(View Files - > Add)并将此json粘贴到其中:
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.CrmSdk.CoreAssemblies": "8.2.0.2"
}
}
}
}
您可以将CoreAssemblies和版本号替换为您需要的软件包,将所有这三个软件包放在依赖项节点中。