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

AppDomain Issue

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(strApplicationName). 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(ByVal strApplicationName As String, ByVal
strApplicationEntryPoint As String) As Form

Dim tmpAppDomain As New AppDomainSetup

Dim tmpAssm As Assembly

Dim strName() As String

Dim strVersion As String

tmpAppDomain.ApplicationBase = "d:\wzprograms"

tmpAppDomain.ShadowCopyFiles = "true"

tmpAppDomain.ShadowCopyDirectories = "d:\wzprograms"

tmpAppDomain.PrivateBinPath = "d:\wzprograms"

'set the cache path for shadow files

tmpAppDomain.CachePath = "d:\wzprograms\tmp"

tmpDomain = AppDomain.CreateDomain("Temp", AppDomain.CurrentDomain.Evidence,
tmpAppDomain)

With tmpDomain

'.ExecuteAssembly("D:\wzprograms\versioncheck.exe" )

tmpAssm = .Load(strApplicationName)

'.ExecuteAssembly(strApplicationName)

End With

'Get the version of the program

strName = Split(tmpAssm.FullName.ToString, ",")

strVersion = strName(1)

'set up the form to display by calling the Entry Point for the program.

LoadProgram = tmpAssm.CreateInstance(strApplicationEntryPoint, True)

Dim extType As Type = tmpAssm.GetType(strApplicationEntryPoint)

Dim extInfo As MethodInfo = extType.GetMethod("SetProperties")

If extInfo Is Nothing Then

MsgBox("This program cannot be run in the framework.", MsgBoxStyle.Critical,
"Invalid Framework Program")

Exit Function

End If

Dim myParamArray() As Object = {12345}

extInfo.Invoke(LoadProgram, myParamArray)

LoadProgram.Name = ("Test")

LoadProgram.Text = "VersionCheck. " & strVersion

AppDomain.Unload(tmpDomain)

End Function
May 23 '06 #1
0 859

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

Similar topics

2
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...
7
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...
4
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...
8
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...
1
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...
1
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. ...
1
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...
10
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...
1
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,...
4
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...
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...
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
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...
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
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...
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...
0
agi2029
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,...

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.