【问题标题】:Why can't my Azure Function find Microsoft.Crm.Sdk.Proxy assembly dependencies?为什么我的 Azure Function 找不到 Microsoft.Crm.Sdk.Proxy 程序集依赖项?
【发布时间】:2017-06-13 06:24:46
【问题描述】:

我正在使用 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.

【问题讨论】:

    标签: azure proxy dynamics-crm


    【解决方案1】:

    您需要在右侧窗格中创建一个 project.json 文件(查看文件 -> 添加)并将此 json 粘贴到其中:

    {
      "frameworks": {
         "net46":{
           "dependencies": {
               "Microsoft.CrmSdk.CoreAssemblies": "8.2.0.2"
            }
         }
      }
    }
    

    您可以将CoreAssemblies和版本号替换为您需要的包,将它们全部放在依赖项节点中。

    【讨论】:

    • 嗨 Ziya,如果它仍然不适合您,您能否将其标记为答案或回复?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-17
    相关资源
    最近更新 更多