473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Unloading and replacing an assembly

I have an application that dynamically loads an assembly dureing runtime. I
want to send a mesage to the application that a new version of the assembly
is available.

I then want to unload the assembly and replace the existing file with a new
file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman
Jan 12 '06 #1
4 1530
Why dont you code your application to look for another file name as the
replacement assembly at regualr intervals, and when it finds the file
delete/rename the old assembly and rename the new one to the old file name.

--
Regards

John Timney
Microsoft MVP

"Jonas Bergman" <jo***********@epani.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have an application that dynamically loads an assembly dureing runtime. I
want to send a mesage to the application that a new version of the assembly
is available.

I then want to unload the assembly and replace the existing file with a
new file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman

Jan 12 '06 #2
The problem is that the assembly is loaded in to the application (the
AppDomain??) and that I can't delete a file that has been used in the
application,. The file is locked.

"John Timney ( MVP )" <ti*****@despammed.com> wrote in message
news:Ov**************@TK2MSFTNGP14.phx.gbl...
Why dont you code your application to look for another file name as the
replacement assembly at regualr intervals, and when it finds the file
delete/rename the old assembly and rename the new one to the old file
name.

--
Regards

John Timney
Microsoft MVP

"Jonas Bergman" <jo***********@epani.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have an application that dynamically loads an assembly dureing runtime.
I want to send a mesage to the application that a new version of the
assembly is available.

I then want to unload the assembly and replace the existing file with a
new file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman


Jan 12 '06 #3
Hello Jonas,
I have an application that dynamically loads an assembly dureing
runtime. I want to send a mesage to the application that a new version
of the assembly is available.

I then want to unload the assembly and replace the existing file with
a new file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman


The assembly would have to be loaded into a different appdomain and treated
with care. If you bring the assembly into your main appdomain you can't unload
it without exiting the application instance.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Jan 12 '06 #4
To avoid assembly file locking use SetShadowCopyFiles() and
SetShadowCopyPath().

"Jonas Bergman" <jo***********@epani.com> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl...
The problem is that the assembly is loaded in to the application (the
AppDomain??) and that I can't delete a file that has been used in the
application,. The file is locked.

"John Timney ( MVP )" <ti*****@despammed.com> wrote in message
news:Ov**************@TK2MSFTNGP14.phx.gbl...
Why dont you code your application to look for another file name as the
replacement assembly at regualr intervals, and when it finds the file
delete/rename the old assembly and rename the new one to the old file
name.

--
Regards

John Timney
Microsoft MVP

"Jonas Bergman" <jo***********@epani.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have an application that dynamically loads an assembly dureing runtime.I want to send a mesage to the application that a new version of the
assembly is available.

I then want to unload the assembly and replace the existing file with a
new file with the same name, without exiting the application.

Is that possible??

/Jonas Bergman



Jan 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LilleSkutt | last post by:
I want to use assemblies (Window Forms as .dll) so that I can replace the form while the main application is running. To accomplish this, I used Assembly.LoadForm to manually load the assembly when I...
2
by: Arthur Roodenburg | last post by:
Hello, I would like to unload an assembly after I finished my stuff. I tried to load the assembly in to an AppDomain like this: AssemblyName asmName =...
5
by: vineeth | last post by:
Hi I have GUI assembly which is loaded into a seprate Appdomain using AppDomain::Load method, after using it's function i unloaded the assembly by calling the AppDomain.UnLoad() method. But i can...
1
by: Microsoft | last post by:
Hi all, I have some application which dynamically loads a module as a DLL Assembly. Both are written in C#. I also would like to be able to dynamically unload this assembly (i.e. to update the...
5
by: Bob | last post by:
I remember reading somewhere that assemblies can be loaded but not unloaded... I can't seem to find where I read it, but I am looking at a problem where I need to load up an assembly from a file...
5
by: ECathell | last post by:
I have done some searches on this and have found Herfrieds suggestions on opening the DLL in a different appDomain. I have not done this before and am curious on the consequences. Below is the code I...
2
by: Benny Raymond | last post by:
Are there any good tutorials on how to unload a dynamically loaded assembly?
1
by: WT | last post by:
Hello, I was using hastable to store collection of objects of the same class MyClass. I start replacing this hastable by a Dictionary<string,MyClass>....but I was storing this hastable in cache...
2
by: Tim | last post by:
Hello, I've finally managed to remotely load a DLL. I've expanded the code to load it in a seperate domain to unload the appdomain, which works to a certain extend. The host application always...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.