VS 2017 でカスタム wf アセンブリのビルドを行いました。
以下は私のコードです。赤い波線はなく、エラーなしで登録されています:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk.Query;
namespace CustomerAsset
{
public partial class CustomerAsset : CodeActivity
{
//public InArgument<EntityReference> CustomerAsset { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
//Create the tracing service
ITracingService tracer= executionContext.GetExtension<ITracingService>();
tracer.Trace("Begin Plugin Execution");
//Create the context
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
try
{
//DO WORK HERE
Entity entity = (Entity)context.InputParameters["Target"];
var targetCustAssOpHrsId = entity.Id;
tracer.Trace(entity.LogicalName);
tracer.Trace(targetCustAssOpHrsId.ToString());
QueryExpression qe = new QueryExpression();
}
catch(Exception ex)
{
throw new InvalidPluginExecutionException("error in CustomerAsset custom workflow assembly");
//throw new InvalidPluginExecutionException(ex);
}
}
}
}
以下は私がすでに試みたものです:
- .NET 4.5.2 に再コンパイル
- コア アセンブリを正しいバージョンの d365 v9 オンラインに確実にターゲット設定
他に落とし穴はありますか?以前の SDK ではなく開発ガイドを使用しているため、これは私にとっては少し新しいことです。
コードからわかるように。トレースしているだけです。トレーサーをインスタンス化した後にトレース書き込みをスローしましたが、それにも到達しません。
また、実行をテストするために、このオンデマンドを実行していることにも注意してください。