2017-06-13 65 views
1

我正在使用Azure函數並希望編寫讀寫動態CRM的代碼。我將CRM SDK DLLs(全部)添加到bin文件夾中。爲什麼我的Azure函數找不到Microsoft.Crm.Sdk.Proxy程序集依賴項?

一些代碼行低於

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. 

回答

1

您需要創建在一個文件project.json右側窗格(查看文件 - >添加)並粘貼此JSON到它:

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

您可以用您需要的軟件包替換CoreAssemblies和版本號,將它們全部放入依賴關係節點中。

+0

嗨Ziya,你可以標記這個答案或答覆,如果它仍然不適合你? – analyzethat

相關問題