O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Load an Assembly from a Remote Location

Problem

You want to run an assembly from a server on your local network or the Internet.

Solution

Use the Assembly.LoadFrom method with a Uniform Resource Identifier (URI) that points to the remote assembly.

Discussion

The Assembly.LoadFrom method accepts an ordinary file path, a network universal naming convention (UNC) path, or a URL Web path. LoadFrom is sometimes used with highly dynamic applications that load components from the Web.

Here’s a basic example that loads an assembly using a URI:

Dim Asm As System.Reflection.Assembly
Dim AsmPath As String = "http://myserver/mydir/myassembly.dll"
Asm = System.Reflection.Assembly.LoadFrom(AsmPath)

If you call LoadFrom and supply a path to a remote assembly, that assembly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required