Alex Feinman Re : DLL in other directory

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Alex,

using System.Reflection;

namespace myApp

public class frmMain : System.Windows.Forms.Form

{

public frmMain()

{

InitializeComponent();

}

Assembly.LoadFrom("\path\to\MyLib.dll")
Assembly.LoadFrom("\path\to\MyOtherLib.dll")
Assembly.LoadFrom("\another path\to\YetAnotherLib.dll")
static void Main()

{

Application.Run(new frmMain());

}

}


with compiling I get a error "Invalid token '(' in class, struct, or
interface member declaration.

Assembly a = Assembly.LoadFrom("\path\to\MyLib.dll") is compiling ok

What could be wrong ?

Thanks Peter.




You don't even need to assign the result anywhere:
Assembly.LoadFrom("\path\to\MyLib.dll")
Assembly.LoadFrom("\path\to\MyOtherLib.dll")
Assembly.LoadFrom("\another path\to\YetAnotherLib.dll")
 
Thanks Daniel,

That did the trick.
I noticed that this only works for DLL's not written in C# but only for
DLL's written in C++ , am I correct ?

Regards
Peter.
 
Unless you meant to write something slightly different to what you did...
you've lost me now...

Alex's approach works for managed dlls (C# or VB.NET).
For placing unmanaged dlls in specific folders there were instructions in
the previous replies (Paul's in particular)

Finally, my £0.02 says you should not be adding any of this complexity for
the sake of nice directory structure; just my opinion :-)

Cheers
Daniel
 
Thanks Daniel,

I tried for example this code with OpenNetCF dll's (C#) .. just to check it
out... it didn't work... however when I tried it with the Resco advanced
list dll (C++ ) it works well.

Regards
Peter.
 
Resco AdvancedList is also a managed (.NET) dll. You might experience
different results with the OpenNETCF dlls since by default they are
installed in the GAC on the device.

Peter
 
Thanks Peter,

The problem for me is that everything I instal on the WinCe 4.2 device is
gone after I reboot my device.
The manufacterer grants me only a directory called "\IPSM" to have my
app's, data and so on.
Everything I put in this directory is kept on the device after reboot.

Regards
Peter.
 
In that case, do not install SDF cab on your development device - it will
interfere with the thing you are doing. Also, do not create your project as
OpenNETCF project - do a standard project and add the OpenNETCF references
by browsing to the appropriate DLLs (ideally, compile your own version)
 
Back
Top