Answered by:
Getting an error for a sample plugin in MS CRM

Question
-
Hi,
I am Getting an error "does not Contain a static 'Main' method suitable for an entry point" for a sample plugin in MS CRM !!
please help me in this !!!
Thanks & regards,
Rajitha.
Thursday, March 3, 2016 6:31 AM
Answers
-
It sounds like you created a Console Application project in Visual Studio, whereas a plugin should be a Class Library project.
You should be able to change the Output type to 'Class Library' in the project properties to correct this
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Marked as answer by Rajitha Surath Tuesday, March 8, 2016 10:25 AM
Thursday, March 3, 2016 11:44 AMModerator -
That is correct. I was able to reproduce. Please right-click on project, select properties and change from Console application to class library.
- Marked as answer by Rajitha Surath Tuesday, March 8, 2016 10:25 AM
Friday, March 4, 2016 12:53 AM
All replies
-
So this error typically occurs with console apps when your code doesn't have a Main. Is your plugin inheriting from interface IPlugin and you implemented the method Execute(IServiceProvider serviceProvider)? If you can provide code, that would be good.Thursday, March 3, 2016 6:49 AM
-
Check the code !! Please
using System;
using System.ServiceModel;
// Microsoft Dynamics CRM namespace(s)
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
namespace Microsoft.Crm.Sdk.Samples
{
public class AccountPlugin : IPlugin
{
public void Execute(IServiceProvider serviceprovider)
{
ITracingService tracingService = (ITracingService)
serviceprovider.GetService(typeof(ITracingService));Thursday, March 3, 2016 7:05 AM -
It sounds like you created a Console Application project in Visual Studio, whereas a plugin should be a Class Library project.
You should be able to change the Output type to 'Class Library' in the project properties to correct this
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Marked as answer by Rajitha Surath Tuesday, March 8, 2016 10:25 AM
Thursday, March 3, 2016 11:44 AMModerator -
That is correct. I was able to reproduce. Please right-click on project, select properties and change from Console application to class library.
- Marked as answer by Rajitha Surath Tuesday, March 8, 2016 10:25 AM
Friday, March 4, 2016 12:53 AM -
Thank You It is working now !!Tuesday, March 8, 2016 10:26 AM
-
Thank you It is working now !!Tuesday, March 8, 2016 10:27 AM