Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Smart Client URL Deployment
Message
From
24/01/2006 10:08:05
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01089608
Message ID:
01089724
Views:
18
Simon,

You didn't say if you were using 1.1 or 2.0. We've done this sort of thing with 1.1 and, as Kevin mentioned, 2.0 has made it easier with "ClickOnce" (although I haven't tried it yet).

If you *are* using 1.1, then Search MSDN for "Smart Client", or try this link: http://msdn.microsoft.com/netframework/programming/winforms/smartclient.aspx

Here's the details in a nutshell:

Basically, you simply need to use the Assembly.LoadFrom method from the System.Reflection class to load your DLLs. It's as simple as that.

Ideally, you should architect your application so that there is a small, lightweight executable installed on the client machine. This executable need not contain much in the way of core logic. Ideally, it just references the DLLs it needs, which reside out on a remote Web server and which supply all of the necessary application logic. We use a Outlook-style sidebar to launch all our modules and they are all loaded through Reflection.

The first time a particular assembly is referenced, it is downloaded to the assembly download cache on the client computer and loaded for use. Going forward, if the assembly required is already on the client computer and the version on the Web server has not changed, the local copy will be loaded. If the version on the Web server has been updated, that new version will be downloaded and executed. Thus, updates are automatically propagated to the client, but the network is not flooded with redundant downloads.

If you haven't architected your application that way to begin with, you could add something to your app to do it after the fact (how you implement this is up to you ... you could have a special form that requires the user to start the download process, or you could do it automatically every time you start the app (could take awhile, depending on how many DLLs you have). But, anyway, here's basically all you need:
// First, an ArrayList containing the filename of all your DLLs. 
// This can be a class, as shown below, or simply a property
public class AssembliesList : ArrayList
{
	public AssembliesList()
	{
		this.Add("MyMainControl.DLL");
		this.Add("MyBusiness.DLL");
		this.Add("SomeOtherOnes.DLL");
	}
}
// Next, the method that actually does the work:
private void DownloadAssemblies()
{
	string URL = GetTheURLWhereYourAssembliesAreLocated();
	string DLL;
	AssembliesList oList = new AssembliesList();

	for (int i = 0; i < oList.Count; i++)
	{
		DLL = oList[i].ToString().Trim();
		try
		{
			System.Reflection.Assembly o =
				System.Reflection.Assembly.LoadFrom(URL + DLL);
		}
		catch (System.Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}
}
~~Bonnie

>Hi Kevin
>
>I have been trying to read as much as I kind find but have yet to actually see a real life demo.
>
>Thanks,
>Simon
>
>>Simon,
>>
>>I can give you some information, but to start with....have you looked at the new ClickOnce deployment capabilities using VS2005?
>>
>>Kevin
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform