Joe Jackson
New member
- Joined
- Sep 16, 2004
- Messages
- 1
- Programming Experience
- 1-3
Hello all,
I am trying to get an application to load if a file type is clicked. I set up the open verb in the file type editor in vs.net and when I click on the type of file the program starts how ever I get a File not found error. The open verb on the file type seems to work since it first loads loader.exe which creates an appdomain for app.exe. But whe it trys to execute the domain an exception is thrown
Thanks
Here is the function that creates the domain from loader.exe :
Public Sub start()
Try
appSetUp.ApplicationBase = "file:///" & Application.StartupPath()
appSetUp.ApplicationName = myFileToRun
appSetUp.PrivateBinPath = Application.StartupPath()
appSetUp.ConfigurationFile = myFileToRun & ".config"
Dim adevidence As System.Security.Policy.Evidence = AppDomain.CurrentDomain.Evidence
domain = AppDomain.CreateDomain(myFileToRun, adevidence, appSetUp)
domain.ExecuteAssembly(myFileToRun, adevidence, myArgs)
Catch e As Exception
MsgBox(e.ToString)
Dim sw As New System.IO.StreamWriter(System.IO.File.Create("D:/temp.txt"))
sw.WriteLine(e.ToString)
sw.Flush()
sw.Close()
End Try
End Sub
Here is the exception :
System.IO.FileNotFoundException: File or assembly name app.exe, or one of its dependencies, was not found.
File name: "app.exe"
Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Shopbot.ProjectWizard.ApplicationLoader.runningApp.start()
=== Pre-bind state information ===
LOG: Where-ref bind. Location = J:\Documents\app.exe
LOG: Appbase = file:///C:\Program Files\vb\
LOG: Initial PrivatePath = C:\Program Files\vb\
Calling assembly : (Unknown).
===
LOG: Found application configuration file (C:\Program Files\vb\app.exe.config).
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///J:/Documents/app.exe.
I am trying to get an application to load if a file type is clicked. I set up the open verb in the file type editor in vs.net and when I click on the type of file the program starts how ever I get a File not found error. The open verb on the file type seems to work since it first loads loader.exe which creates an appdomain for app.exe. But whe it trys to execute the domain an exception is thrown
Thanks
Here is the function that creates the domain from loader.exe :
Public Sub start()
Try
appSetUp.ApplicationBase = "file:///" & Application.StartupPath()
appSetUp.ApplicationName = myFileToRun
appSetUp.PrivateBinPath = Application.StartupPath()
appSetUp.ConfigurationFile = myFileToRun & ".config"
Dim adevidence As System.Security.Policy.Evidence = AppDomain.CurrentDomain.Evidence
domain = AppDomain.CreateDomain(myFileToRun, adevidence, appSetUp)
domain.ExecuteAssembly(myFileToRun, adevidence, myArgs)
Catch e As Exception
MsgBox(e.ToString)
Dim sw As New System.IO.StreamWriter(System.IO.File.Create("D:/temp.txt"))
sw.WriteLine(e.ToString)
sw.Flush()
sw.Close()
End Try
End Sub
Here is the exception :
System.IO.FileNotFoundException: File or assembly name app.exe, or one of its dependencies, was not found.
File name: "app.exe"
Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Shopbot.ProjectWizard.ApplicationLoader.runningApp.start()
=== Pre-bind state information ===
LOG: Where-ref bind. Location = J:\Documents\app.exe
LOG: Appbase = file:///C:\Program Files\vb\
LOG: Initial PrivatePath = C:\Program Files\vb\
Calling assembly : (Unknown).
===
LOG: Found application configuration file (C:\Program Files\vb\app.exe.config).
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///J:/Documents/app.exe.