I have the following code that creates a new appDomain and loads an exe
using reflection. The problem I have is the exe file I pass in is still
locked by the application. I have showcopyfiles = "true" and specified the
locations for the appDomain to use. The shadowfiles and the original file is
locked when I execute the command tmpAssm = .Load(strApplic ationName). Now
if I have shadowcopyfiles on, why would setting the assembly to the file
lock it? Any help is appreciated.
John
Private tmpDomain As AppDomain
Public Function LoadProgram(ByV al strApplicationN ame As String, ByVal
strApplicationE ntryPoint As String) As Form
Dim tmpAppDomain As New AppDomainSetup
Dim tmpAssm As Assembly
Dim strName() As String
Dim strVersion As String
tmpAppDomain.Ap plicationBase = "d:\wzprogr ams"
tmpAppDomain.Sh adowCopyFiles = "true"
tmpAppDomain.Sh adowCopyDirecto ries = "d:\wzprogr ams"
tmpAppDomain.Pr ivateBinPath = "d:\wzprogr ams"
'set the cache path for shadow files
tmpAppDomain.Ca chePath = "d:\wzprograms\ tmp"
tmpDomain = AppDomain.Creat eDomain("Temp", AppDomain.Curre ntDomain.Eviden ce,
tmpAppDomain)
With tmpDomain
'.ExecuteAssemb ly("D:\wzprogra ms\versioncheck .exe")
tmpAssm = .Load(strApplic ationName)
'.ExecuteAssemb ly(strApplicati onName)
End With
'Get the version of the program
strName = Split(tmpAssm.F ullName.ToStrin g, ",")
strVersion = strName(1)
'set up the form to display by calling the Entry Point for the program.
LoadProgram = tmpAssm.CreateI nstance(strAppl icationEntryPoi nt, True)
Dim extType As Type = tmpAssm.GetType (strApplication EntryPoint)
Dim extInfo As MethodInfo = extType.GetMeth od("SetProperti es")
If extInfo Is Nothing Then
MsgBox("This program cannot be run in the framework.", MsgBoxStyle.Cri tical,
"Invalid Framework Program")
Exit Function
End If
Dim myParamArray() As Object = {12345}
extInfo.Invoke( LoadProgram, myParamArray)
LoadProgram.Nam e = ("Test")
LoadProgram.Tex t = "VersionChe ck. " & strVersion
AppDomain.Unloa d(tmpDomain)
End Function 0 887 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Satinderpal Singh |
last post by:
Hi All,
I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have
not given reference to that DLL from the EXE).
Now, i call some commands of that dll from the EXE, and in the background i
try to delete the DLL, it does not allows (fair enough).
Now, I unload that AppDomain using AppDomain.Unload method. Now, I try to
delete that DLL from the background it still does not allows, I thought the
|
by: José Joye |
last post by:
I have a windows service where I create another appdomains. In the newly
created AppDomain, I make use of a C library. If I issue an Abort(1) within
this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I
prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
|
by: stu_pb |
last post by:
I am designing a plugin system for a window application using .NET(C#
specifically). One of the requirements of the plugin system is to be able to
dynamically load/unload plugins.
My initial thought was to use System.Reflection.Assembly.Load to load the
plugins dynamically. This worked great, but I was left with no way to
dynamically unload the plugin.
So now I come to creating a new AppDomain for the plugins to reside in,
since the...
|
by: A. Elamiri |
last post by:
Hello,
I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code:
....
AppDomainSetup ads = new AppDomainSetup();
string path =
|
by: BuddyWork |
last post by:
I think I've found a possible issue with .Net AppDomain.Unload when
using attribute LoaderOptimization.MultiDomain.
Here you will need ProcessExplorer from SysInternals to see what
assemblies are loaded for a given process.
You will need to add the following code into HelloWorld1.cs and compile
through the CS compiler. csc HelloWorld1.cs
// C# Sample Code
| |
by: Andrew Ducker |
last post by:
I'm trying to load an assembly into a temporary AppDomain rather than
my main AppDomain, so that it can be unloaded later on. However, it's
also loading into my main AppDomain at the same time.
My code is:
AppDomain a = AppDomain.CreateDomain("TestDomain");
a.Load("AppDomainTestAssembly");
and in the Console window I get the following when the second line
executes:
|
by: Dan Dorey |
last post by:
Hey,
I've created a very simple test app to try and fix a problem I'm
having. Basically I'm trying to log to a text file from a class in a
seperate app domain that I've created. When I first create the
AppDomain I'm able to log. However, I have the requirement that I'll
have to tear down the AppDomain and then load it back up again. When I
do this I no longer get any logging.
|
by: =?Utf-8?B?U3RlZmFuIEJhcmxvdw==?= |
last post by:
This has been working perfectly for months. Since we switched from ASP.NET
1.1 to 2.0, we have constant and sporadic issues with updating our
applications.
Touching the web.config works about 40% of the time to cause an AppDomain to
reload and flush all assemblies. Sometimes it works perfectly, but other
times some Assemblies are not reloaded into the AppDomain, even after
multiple web.config file touches. Sometimes multiple versions...
|
by: Bill Woodruff |
last post by:
Visual Studio 2005, .NET FrameWork 2.0, C#, WinForms Application
Hi,
I've read the recent posts by and to 'Thunderbird' (and learned a lot,
thanks, from the usual masters Skeet and Paladino, and others) which involve
AppDomains in a remoting scenario, but I think the issue I am working with
.... while related ... is sufficiently different to warrant a new thread.
I'm also working on a plug-in architecture it's for a WinForms based
|
by: illegal.prime |
last post by:
Hi all, I'm getting unexpected results when trying to preload
assemblies into an AppDomain I'm creating. Upon creation of the
AppDomain - I attach an AssemblyResolve to both my current AppDomain
and the new AppDomain I create.
I copy all the assemblies/dlls into a new directory and then try
loading them all into the new AppDomain using the following:
private void LoadAssembliesFromDirectory(AppDomain appDomain, string
directory)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |