Load assembly doesn't worked correctly

前端 未结 1 761

I try to load a assembly into my source code in C#. So i first compile the source file:

 private bool testAssemblies(String sourceName)
        {
            Fil         


        
1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-14 13:04

    I think your syntax is wrong. Assembly.load(string) expects the assembly name

    Assembly.Load("SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3");
    

    Also make sure you're using the right overload for your needs (which usually is indeed Assembly.Load) http://blogs.msdn.com/b/suzcook/archive/2003/05/29/57143.aspx

    EDIT use this:

    AssemblyName an = AssemblyName.GetAssemblyName(filePath);
    Assembly.Load(an);
    

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