Answered by:
Error in registering plugin ... Unhandled Exception: System.IO.InvalidDataException: Assembly name sample plugin 1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a7b2dbf6f9d6f62c cannot be parsed.

Question
-
I've a simple plugin with few lines of code. Actual functionality is yet to be added. Plugin code is as below:
using System; using System.Collections.Generic; using System.Text; using System.Net; using Microsoft.Crm.Sdk; using Microsoft.Crm.SdkTypeProxy; using CrmWsdl=sample_plugin_1.CrmWsdl; namespace sample_plugin_1 { public class test1 : IPlugin { public void Execute(IPluginExecutionContext context) { string orgName = "myOrg"; string wUrl = "http://10.30.1.109:5555/MSCrmServices/2007/CrmService.asmx"; CrmService ser = new CrmService(); ser.Url = wUrl; CrmAuthenticationToken myToken = new CrmAuthenticationToken(); myToken.AuthenticationType = 0; myToken.OrganizationName = orgName.ToString(); ser.CrmAuthenticationTokenValue = myToken; ser.Credentials = new NetworkCredential("username", "password", "domain"); WhoAmIRequest whoRequest = new WhoAmIRequest(); WhoAmIResponse whoResponse = (WhoAmIResponse)ser.Execute(whoRequest); } } }
I am using Plugin Registration Tool 2.2.0.0 which has already successfully registered few custom workflows. I've copied to .dll, .pdb and .config file in c:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly as well. This path already has CRM SDK dlls. When i try to load this assembly (.dll) to register, it throughs following exception on Load Assembly Button:
Unhandled Exception: System.IO.InvalidDataException: Assembly name sample plugin 1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a7b2dbf6f9d6f62c cannot be parsed.
at PluginRegistrationTool.AssemblyReader.RetrieveAssemblyProperties(Assembly assembly, String path)
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)
at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)
I've put the same code in a windows app and have tested it several times and it works fine.
Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.comFriday, September 18, 2009 8:44 AM
Answers
-
ok i've hit the bottom line :) ...
my DLL name was "sample plugin 1.dll" ... pleaes note that it contains space in its name...i created a new assembly sampleplugin2.dll and it worked fine...
But i will always wish to know the reason although...
Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.com- Proposed as answer by Andrew Wolfe Thursday, September 24, 2009 9:51 AM
- Marked as answer by Sohaib [CRM Professional] Thursday, September 24, 2009 10:35 AM
Friday, September 18, 2009 9:42 AM
All replies
-
Is your your assembly signed?
Have you tried to register your plugin in database instead of path?Friday, September 18, 2009 8:51 AM -
yap my assembly is signed...
adding to database/disk/GAC is a step ahead of where i am stuck ... when i browse the .dll file, i get the specified error :(
Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.comFriday, September 18, 2009 8:53 AM -
use following statement in plug in to get crm service during plugin..
// Obtain IcrmService so we can call into CRM SDK to retrieve // accounts ICrmService crmService = context.CreateCrmService( true);
Also have look at following artile ..
http://msdn.microsoft.com/en-us/library/cc151102.aspx
if after changin code, it is still not working I suggest debug the plug in and see what line actuallly throws exception..
Plug in dubuggin steps :
1-Ensure that your plug-in is signed
2-Rebuild the plug-in
3-run an iisreset command
4-copy the .pdb file and your .dll file to server\bin\assembly
5-Register the Plugin Registration Tool V2 (http://code.msdn.com/crmplugin)
Refer to your dll in bin\assembly
Make it disk deployment
6-Register the step
7-Register the image if needed
8-Attach to w3wp.exe if Synchronous plug-in or to AsyncService if asynchronous plug-in
Hope this helps...
Friday, September 18, 2009 8:58 AM -
use following statement in plug in to get crm service during plugin..
// Obtain IcrmService so we can call into CRM SDK to retrieve
// accounts
ICrmService crmService = context.CreateCrmService(
true );
Truth is opened the prepared mind My blog - http://a33ik.blogspot.comFriday, September 18, 2009 9:10 AMModerator -
It didn't do the trick Mayank :(
I even tried blank function
public void Execute(IPluginExecutionContext context)
{
//Do nothing
}
even i failed to load this one :(
Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.comFriday, September 18, 2009 9:38 AM -
ok i've hit the bottom line :) ...
my DLL name was "sample plugin 1.dll" ... pleaes note that it contains space in its name...i created a new assembly sampleplugin2.dll and it worked fine...
But i will always wish to know the reason although...
Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.com- Proposed as answer by Andrew Wolfe Thursday, September 24, 2009 9:51 AM
- Marked as answer by Sohaib [CRM Professional] Thursday, September 24, 2009 10:35 AM
Friday, September 18, 2009 9:42 AM -
Just met this same issue had to change from "Workflow Utilities.dll" to WorkflowUtilities.dll. I don't think that this is in the documentation anywhere. Thanks very much Sohaib for finding and posting the answer to your own question.Thursday, September 24, 2009 9:55 AM