Answered by:
Plugin will not load assembly

Question
-
I am using Plugin Registration tool, but the dll file will not load. Error is below. We are successfully using this dll in another deployment. After moving the dll, under properties there is no 'Unblock' button. Any ideas appreciated.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\synact1\Desktop\SYNACT\Plugin\Plugin_Registration_Tool\Plugin Registration Tool\PluginRegistration.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)
at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)
at PluginRegistrationTool.AppDomainContext`1..ctor()
at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)
at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)
Inner Exception: System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
Ken Compter
Tuesday, February 12, 2013 5:25 PM
Answers
-
Thanks to all for their ideas. Not sure what the issue was, but I re-downloaded the sdk, opened plugin registration tool, and the assembly loaded. Now if I only had hair left!
Ken Compter
- Marked as answer by DavidJennawayMVP, Moderator Friday, February 15, 2013 11:59 AM
Thursday, February 14, 2013 3:57 PM
All replies
-
Hi,
is the dll you are trying to load located on the same server where you deployed plugin registration tool, or is it on a network share? If it's on the network share, could you try to use a local copy instead?
Alex Shlega, GotchaHunter.Net
Tuesday, February 12, 2013 10:39 PM -
goto -->eventview -->administrator see the error details in it...
check the connections in th plug-in registration tool
reset iis
ms crm
Wednesday, February 13, 2013 9:56 AM -
tried both remotely and local. several discussions pointed at the dll properties and "unblock" but I do not have that in the dll properties.
Ken Compter
Wednesday, February 13, 2013 4:51 PM -
The error looks like it comes from trying to load PluginRegistration.exe, rather than a specific assembly dll. When does the error occur ?
The error also says that it's due to trying to load an assembly from a network location. Although the path looks local (C:\users....), this is part of a user's profile, and could be mapped to a network location. Try copying PluginRegistration.exe, and your assembly to an alternate location (outside of c:\users) on a local drive
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
Thursday, February 14, 2013 9:54 AMModerator -
Sometimes I face a similar problem when loading .dll files. In these cases, I completely copied the "debug" folder to the server desktop which I want to register the plugin on. Then the dll file located in the folder loaded correctly. Maybe this help you.
If the answer helped you, remember to mark it as answer.
- Edited by Payman BiukaghazadehEditor Thursday, February 14, 2013 2:13 PM
Thursday, February 14, 2013 2:12 PMModerator -
Thanks to all for their ideas. Not sure what the issue was, but I re-downloaded the sdk, opened plugin registration tool, and the assembly loaded. Now if I only had hair left!
Ken Compter
- Marked as answer by DavidJennawayMVP, Moderator Friday, February 15, 2013 11:59 AM
Thursday, February 14, 2013 3:57 PM