473,385 Members | 1,347 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,385 software developers and data experts.

How to UNLOAD an Assembly after you LoadFile(...)??

mdb
I'm trying to develop an application who's GUI will be changing frequently,
used by hundreds of people in a corporation.

In order to support this, I've created a small .NET web page that loads the
assembly, grabs the version number, and reports it in an XML document to
the client (a .NET stub loader application). The stub application compares
the version reported in the XML to the version of the DLL that it has, and
if the reported version is newer, it downloads the file and executes the
appropriate code.

My problem is that the ASPX web page, after loading the assembly, doesn't
release the file lock. In order to update the DLL, I have to restart the
IIS services. If I don't do this, I can't delete it because the web server
still has the file locked.

How can I unload the assembly once its been loaded??

(Please.... no comments on the philosophy of a frequently changing GUI -
I have my reasons for doing this.)

Thanks!!

-mdb
Jul 21 '05 #1
2 2372
As far as I know, there is no way to do this.

What I have done before, is read the bytes of an assembly file into a byte
array, and then create an assembly object from that byte array. That works
without the lock on the file, since it is released when the filestream is
closed.

"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xn****************************@207.46.248.16. ..
I'm trying to develop an application who's GUI will be changing frequently, used by hundreds of people in a corporation.

In order to support this, I've created a small .NET web page that loads the assembly, grabs the version number, and reports it in an XML document to
the client (a .NET stub loader application). The stub application compares the version reported in the XML to the version of the DLL that it has, and
if the reported version is newer, it downloads the file and executes the
appropriate code.

My problem is that the ASPX web page, after loading the assembly, doesn't
release the file lock. In order to update the DLL, I have to restart the
IIS services. If I don't do this, I can't delete it because the web server still has the file locked.

How can I unload the assembly once its been loaded??

(Please.... no comments on the philosophy of a frequently changing GUI -
I have my reasons for doing this.)

Thanks!!

-mdb

Jul 21 '05 #2
mdb
"Marina" <so*****@nospam.com> wrote in
news:uB*************@TK2MSFTNGP10.phx.gbl:
What I have done before, is read the bytes of an assembly file into a
byte array, and then create an assembly object from that byte array.
That works without the lock on the file, since it is released when the
filestream is closed.


Worked wonderfully! Thanks!

-mdb
Jul 21 '05 #3

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

Similar topics

4
by: Mirano | last post by:
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is...
2
by: Sam Martin | last post by:
Morning all, Right, I've read untold articles now, listening to people bitch about there being no Unload method for Assembly. Plenty of people do counter that this is possible by loading the...
6
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider...
2
by: Jan Schustr | last post by:
HI All, i load assembly like this Asembly v_asm = System.Reflection.Assembly.LoadFile("MYdll.dll"); and initialize class with object v_obj = Activator.CreateInstance(....); but How can I...
4
by: Barry Kelly | last post by:
I'm designing an application framework which will, amongst other things, live in an assembly hosted in the ASP.NET worker process, servicing webservice requests. Here's the scenario: APPFX is...
2
by: Dominique Vandensteen | last post by:
I want to make a program that checks for updates at start... The way I am doing this is to create 2 projects... A simple exe checks the server for the version and downloads a dll if needed. The...
11
by: Michael Maes | last post by:
Hello, I want to be able to load an assembly by selecting a dll from an OpenFileDialog. This seems to work, exept when that assembly references "3rd-Party dll's". Just this simple line: Dim...
2
by: mdb | last post by:
I'm trying to develop an application who's GUI will be changing frequently, used by hundreds of people in a corporation. In order to support this, I've created a small .NET web page that loads...
5
by: Fabio Cannizzo | last post by:
MyEXE loads myDLL at runtime using Assembly.LoadFile("myDLL.dll"). Then I create an instance of a class contained in MyDLL using Reflection. When I terminate the debug session of my EXE file,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.