I am trying to write a plugin but I seem to be unable to even get a basic one to run.
few things:
the class is public,
It is signed,
version sdk is 8.2.1.1
Also the profiler will not help do to its own issue (Unexpected exception from plug-in). I have tried to copy and paste the sample code in and get the same error every time.
I am now just try to get a shell that does not do any thing to run. Here is the code
using Microsoft.Xrm.Sdk;
using System;
namespace basicPlugin
{
public class basicPlugin : IPlugin
{
#region Secure/Unsecure Configuration Setup
private string _secureConfig = null;
private string _unsecureConfig = null;
public basicPlugin(string unsecureConfig, string secureConfig)
{
_secureConfig = secureConfig;
_unsecureConfig = unsecureConfig;
}
#endregion
public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.UserId);
try
{
Entity entity = (Entity)context.InputParameters["Target"];
//TODO: Do stuff
}
catch (Exception e)
{
throw new InvalidPluginExecutionException(e.Message);
}
}
}
}