一、修改错误
昨天登录报错

今天开始返回我之前设置的断点开始重新配置,Reporing Services配置完成后发现dynamics365还是下载失败
之后下载了一上午dynamics365就一直卡在最后的界面进度条不动
索性我直接把所有环境都卸载了 连同虚拟机卸载重装
终于在下午的时候dynamics365貌似下载成功了

SSRS也出现了
然后下载SSRS

就按照提示下载

安装完成

二、创建插件项目
官方文档:教程:编写和注册插件 (Microsoft Dataverse) - Power Apps |微软学习
为插件创建 Visual Studio 项目
打开Visual Studio并使用.NET Framework 4.6.2打开一个新的类库(.NET Framework)项目
去下载.Net Framwork4.6.2
下载网址:https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/net462

安装成功

1、新建一个类库项目
.Net Framwork 4.6.2

2、下载程序包
通过Nuget包管理器下载:
Microsoft.CrmSdk.CoreAssemblies
Microsoft.Crm.Sdk.Proxy.2015
Microsoft.Xrm.Sdk.2015
Microsoft.XRM.SDK.2015.OnPremise

额外补充的两个Nuget包:
Microsoft.CrmSdk.Deployment(没成功)
Microsoft.CrmSdk.Workflow
下载程序集

3、实现 IPlugin 接口
通过编辑类来实现 IPlugin 接口

将该方法的内容替换为以下代码:Execute
// Obtain the tracing service
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
// The InputParameters collection contains all the data passed in the message request.
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters["Target"];
// Obtain the organization service reference which you will need for
// web service calls.
IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
try
{
// Plug-in business logic goes here.
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException("An error occurred in FollowUpPlugin.", ex);
}
catch (Exception ex)
{
tracingService.Trace("FollowUpPlugin: {0}", ex.ToString());
throw;
}
}
该插件将创建一个任务活动,该活动将提醒帐户的创建者在一周后跟进。
将以下代码添加到 try 块。替换注释:。与以下内容:// Plug-in business logic goes here
// Create a task activity to follow up with the account customer in 7 days.
Entity followup = new Entity("task");
followup["subject"] = "Send e-mail to the new customer.";
followup["description"] =
"Follow up with the customer. Check if there are any new issues that need resolution.";
followup["scheduledstart"] = DateTime.Now.AddDays(7);
followup["scheduledend"] = DateTime.Now.AddDays(7);
followup["category"] = context.PrimaryEntityName;
// Refer to the account in the task activity.
if (context.OutputParameters.Contains("id"))
{
Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());
string regardingobjectidType = "account";
followup["regardingobjectid"] =
new EntityReference(regardingobjectidType, regardingobjectid);
}
// Create the task in Microsoft Dynamics CRM.
tracingService.Trace("FollowupPlugin: Creating the task activity.");
service.Create(followup);
这里运行发现报错了

去下载.Net Framwork4.5.2
下载地址:下载 .NET Framework 4.5.2 Developer Pack Offline Installer (microsoft.com)

然后重复上边的步骤
4、对插件进行签名
1、在“解决方案资源管理器”中,右键单击 BasicPlugin 项目,然后在上下文菜单中选择“属性”。
2、在项目属性中,选择“签名”选项卡,然后选中“为程序集签名”复选框。

3、在“选择强名称密钥文件:”下拉列表中,选择<新建...>。
在“创建强名称密钥”对话框中,输入密钥文件名并取消选中“使用密码保护我的密钥文件”复选框。

5、单击“确定”关闭“创建强名称密钥”对话框。
6、在项目属性“生成”选项卡中,验证“配置”是否设置为“调试”。
7、按 F6 再次生成插件。
8、使用 Windows 资源管理器,在以下位置找到内置插件:。\bin\Debug\BasicPlugin.dll

5、注册程序集
一、在“注册”下拉列表中,选择“新建程序集”。
选择第一个

二、在“注册新程序集”对话框中,选择省略号 (...) 按钮并浏览到在上一步中生成的程序集。

三、单击注册所选插件。

四、您将看到“已注册插件”确认对话框。

五、单击“确定”关闭对话框并关闭“注册新程序集**”**对话框。
您现在应该看到(程序集)BasicPlugin 程序集,您可以展开该程序集以查看(插件)BasicPlugin.FollowUpPlugin 插件。

三、打开虚拟机
双击Demo

然后进入一个网页 把网址复制下来去主机登录
进不去就等会 反复试试
