【发布时间】:2019-09-25 11:32:53
【问题描述】:
我将 RestSharp 用于 Dynamics 插件,这要求项目是 DLL。运行插件时收到此错误消息:
ISV 代码出现意外错误。 (ErrorType = ClientError)插件(执行)的意外异常:pluginname.PluginEntryPoint:System.IO.FileLoadException:无法加载文件或程序集'RestSharp,Version = 105.0.0.0,Culture = Neutral,PublicKeyToken = null'或一个其依赖项。需要强命名程序集。 (HRESULT 例外:0x80131044)如果您联系支持人员,请提供技术细节
我的代码使用的是 .NET Framework 4.6.2,RestSharp 版本是 106.6.10
这是我要运行的代码:
var body = " {\"data\": [{ \"name\": " + name + ", \"parent_id\": \"0\", \"short_code\": " + shortcode + ", \"billable\": \"yes\", \"assigned_to_all\": \"yes\", \"billable_rate\": \"37.50\"}]}";
var client = new RestClient("https://rest.tsheets.com/api/v1/jobcodes");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");//authorisation token
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
return true;
我怎样才能解决这个问题?
【问题讨论】:
-
请提供您尝试运行的代码
-
我已经更新了帖子以包含代码,它用于 TSheets 集成
-
如果解决方案中有其他项目,请确保所有项目使用相同版本的RestSharp dll或包。
-
其他项目根本不使用RestSharp
标签: c# rest plugins microsoft-dynamics restsharp