Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > ClickOnce and Apps that dynamically load assemblies without knowoing in advance what they are
 

ClickOnce and Apps that dynamically load assemblies without knowoing in advance what they are

I have an application (VS2003 currently) that dynamically loads dll's which contain data entry forms,  reports and other classes for a variety of tests. Each test has a separate dll. The dlls are not compiled into the application, but dynamically loaded.
 
Here is how that works: Each dll is named with a pattern that includes the test name: eg FieldTest_ABC.dll or FieldTest_XYZ.dll. Based on the user selecting which test to load up, the test's name (eg "ABC") is passed into a routine which checks for the existince of file FieldTest_ABC.dll and if it does exist, loads it up using reflection.

SO....I have used the version 1 of applictaion updater block but I had to customize it for this scenario. Additionally, since there can be many tests and we only add new onces occasionally, I did not want updater to download ALL of the old tests ever time. We have users on dialup and this is a bad thing for them. In the long run, the success was inconsistent and the the entire thing was broken by the update of BITS in the windows operating system. I can't say that my client was very impressed and web deployment has been the absolute BAIN Tongue Tied of my .NET development experience for over 3 years.

Now comes click once. I have not spent a lot of time with it but have looked over some of the documentation. I would like to know if either of the above scenarios are easily handled (without major in ClickOnce customization) before I spend a lot of time going down a possibly dead-end path. I am considering updating the entire application (which is a complex app with many layers) and this also means upgrading my ws security from wse2 to wse3, so its a big undertaking - and is only worth it if I can FINALLY get this type of deployment to work successfully.

Thanks very much for any leads

julie lerman
Julie Lerman  Friday, September 30, 2005 4:52 PM
ClickOnce as such will not do any detection that a dll that need to be loaded is not available and needs to be downloaded from network.
It is the application's responsibility. ClickOnce provides APIs to download them when you need them.

If your scenario is 
   - I have an app 
   - It does not reference any dlls to begin with 
   - At run time it needs Test_A.dll, Test_B.dll, Test_C.dll depending on what test needs to be run

ClickOnce Solution :

When you publish your app you need to publish your app and Test_A.dll, Test_B.dll, Test_C.dll. In ClickOnce you can publish any files, dlls along with the app even though they are not statically referenced when the app is compiled.

When the app is downloaded all the dlls/files are downloaded along with the exe. You can load what ever you want and when ever you want.

On the other hand, if you want to optimize your network download 
   - You can make Test_A.dll, Test_B.dll, Test_C.dll as optional 
   - When the app needs to load Test_A.dll, you download it first using ClickOnce   then load it

The VS publishing wizard provides all these publish features. You can also use MAGE.exe that ships with SDK to achieve this.

Hope this clears your deployment scenario better. If I am missing anything here you can elaborate

-Sreekanth
kanthb  Friday, September 30, 2005 10:27 PM
ClickOnce is definitely of help to you here..
I understand that your concern here is all the old test dlls are downloaded each time your app ("Test Manager") exe is updated.

In clickonce world when the app is updated you will still publish the app and ALL the test dlls each time on the server. But while downloading ClickOnce downloads only the files that are changed/New. The rest of all the unchanged files ClickOnce copies from the previous version app (previously downloaded copy of the files). This way Clickonce avoids downloading over the wire when not needed and does a local machine copy.

Additionally if you still want to minimize the downloads over wire, any test dlls which you think are infrequently used among your users you can mark them optional and download them on demand. You can use APIs in System.Deployment Namespace to achieve this.

Hope this helps

Sreekanth
kanthb  Friday, September 30, 2005 7:48 PM
That is great to know! THanks.

Hopefully someone will know about how ClickOnce will detect DLL's that are not referenced in the application in a way that reflection will be able to identify which dll's need to be sought out.
Julie Lerman  Friday, September 30, 2005 8:04 PM
ClickOnce as such will not do any detection that a dll that need to be loaded is not available and needs to be downloaded from network.
It is the application's responsibility. ClickOnce provides APIs to download them when you need them.

If your scenario is 
   - I have an app 
   - It does not reference any dlls to begin with 
   - At run time it needs Test_A.dll, Test_B.dll, Test_C.dll depending on what test needs to be run

ClickOnce Solution :

When you publish your app you need to publish your app and Test_A.dll, Test_B.dll, Test_C.dll. In ClickOnce you can publish any files, dlls along with the app even though they are not statically referenced when the app is compiled.

When the app is downloaded all the dlls/files are downloaded along with the exe. You can load what ever you want and when ever you want.

On the other hand, if you want to optimize your network download 
   - You can make Test_A.dll, Test_B.dll, Test_C.dll as optional 
   - When the app needs to load Test_A.dll, you download it first using ClickOnce   then load it

The VS publishing wizard provides all these publish features. You can also use MAGE.exe that ships with SDK to achieve this.

Hope this clears your deployment scenario better. If I am missing anything here you can elaborate

-Sreekanth
kanthb  Friday, September 30, 2005 10:27 PM

Hi, there. I have similar problems with Julie's except that I don't know how many dlls I'll have ahead of time.
Actually, dlls will be published by differentusers into designated folderthrough FTP.
Is there way to publish dlls individually? - notpart ofthe app.
And can the appdownload the dlls using ClickOnce API on demand todesignated folder(somewhere under the app folder)so that the app canload dll into memory?
I appreciate for your help.



chrisk414  Wednesday, August 26, 2009 7:41 PM

You can use google to search for other answers

Custom Search

More Threads

• UnInstall Product using Web Page
• Need Trusted CA
• Launch Conditions. Xp 32 or any vista or higher
• Installing Redistributable Packages from a Networked Location...
• Urgent!! Install an App for every user in the current machine!!
• Embedding assemblies in one DLL
• Adding files to an installer after it has been built.
• Registry XP
• Custom Action Not Being Called - Can't Figure Out Why
• Registering dll in global assembly catch without using utility