Loading plug-in DLL files, “The invoked member is not supported in a dynamic assembly.”

前端 未结 3 1890
时光取名叫无心
时光取名叫无心 2021-02-05 04:56

We have custom DLL\'s that are not included in our initial setup file. They are loaded at runtime. This process worked fine while using .NET 2.0, but we are getting the \"The

相关标签:
3条回答
  • 2021-02-05 05:41

    This in the app.config file allows for "plug-in" dll's from remote sources.

    <configuration>
       <runtime>
          <loadFromRemoteSources enabled="true"/>
       </runtime>
    </configuration>
    

    http://msdn.microsoft.com/en-us/library/dd409252.aspx

    0 讨论(0)
  • 2021-02-05 05:50

    For me this issue was not embedding the license for a Aspose dll: http://www.aspose.com/community/forums/thread/423874/initializing-the-license-file.aspx

    Their code injects dynamic assemblies when a license isn't detected, causing their DLLs to fail, as well as a bunch of other code that isn't compatible with dynamic assemblies.

    Not sure if this is a common licensing/activation method for ensuring registered use with 3rd party dlls, so I'll post it here for google if it is.

    0 讨论(0)
  • 2021-02-05 05:52

    This error is occurring because Assembly.Load cannot be called upon dynamic assemblies. You must filter out the dynamic assemblies before using them.

    var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(p => !p.IsDynamic);

    0 讨论(0)
提交回复
热议问题