473,387 Members | 3,801 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,387 software developers and data experts.

How to unload the assembly?

I have a problem... A webservice I built check the version of an assembly by
using this code:
app = [Assembly].LoadFrom(Server.MapPath(appName & "\" & assemblyName))
' Return it's version
Return app.GetName.Version.ToString

when another app is uploading a new version of that file I get a
securityexception stating the file is in use...

The ony code i have that accesses that file is the above code... so what is
going on?

I can't unload an assembly without disposing the entire app domain...
/Henrik
Jul 21 '05 #1
1 1357
To get assembly information, you would be better off using the AssemblyName
class:

Private Function GetAsmVersion( _
ByVal sAssemblyFileName As String) As String
Dim asmName = _
AssemblyName.GetAssemblyName(sAssemblyFileName)
Return asm.Version.ToString
End Function

GetAssemblyName loads the file, extracts the information and then closes
back the file. The assembly is not loaded into the app domain and so you
don't have to deal with unloading it from the app domain.

hope that helps..
Imran.

"Henrik Nordgren" <He************@discussions.microsoft.com> wrote in
message news:A2**********************************@microsof t.com...
I have a problem... A webservice I built check the version of an assembly by using this code:
app = [Assembly].LoadFrom(Server.MapPath(appName & "\" & assemblyName))
' Return it's version
Return app.GetName.Version.ToString

when another app is uploading a new version of that file I get a
securityexception stating the file is in use...

The ony code i have that accesses that file is the above code... so what is going on?

I can't unload an assembly without disposing the entire app domain...
/Henrik

Jul 21 '05 #2

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

Similar topics

0
by: Lloyd Sheen | last post by:
I am having trouble gettting an assembly loaded with Assembly.LoadFrom. I can get the assembly call the method I need to call. Now I want to unload the assembly. I need to do this so that the...
0
by: Lloyd Sheen | last post by:
I am having trouble gettting an assembly loaded with Assembly.LoadFrom. I can get the assembly call the method I need to call. Now I want to unload the assembly. I need to do this so that the...
1
by: Andy | last post by:
Hi everybody, i´m working on an application that loads different modules (dll files) via an assembly. I check the build version in that dll file and if a newer version exists, i want to update...
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: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload....
1
by: Luis Pinho | last post by:
Hi There, I've got a server that is waiting for requests, these request correspond to calls to objects that are specified in assemblies stored in the GAC. To do this, I use reflection to call...
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: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
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...

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.