Hi there.
Thank god for beer!
The current predicament of the week is as follows:
I have two assemblies in a single solution, A and B. Assembly A is an application that installs a context menu into the file system (like that Winzip Icon when you right click on a file). When a user clicks on one of the options to that function, such as "Add this file!", a new object of assembly is instantiated and the method AddFile(filename) is called - then the object is disposed.
The AddFile method simply appends the name of the working file to a text file in the same directory as the calling assembly. If the file does not exist, it creates it. Here is the code I used to get the executing assembly:
Private myassembly As System.Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
Private tempfile As FileInfo = New FileInfo(myassembly.Location)
Private m_filelist As String = tempfile.DirectoryName & "\FileList.txt"
This works great when I compile and run it in V Studio . NEt. The context menu works and the text file gets created when not present. However...when I create an installation package and deploy the app, Im not getting the anticipated result. Everything installs and all .dlls are copied to the program directory. The menu works fine - the only issue I have is that it is writing back to the directory where I compiled the original code for the context menu (assembly A) - as opposed to the application directory.
Does anyone have an idea of why this would happen? When I isolate the Assembly B and call AddFile from a command line app, it works fine when deployed. The issue seems to be in the method I am calling or instantiating an object of class B from Assembly A.
this kept me up many nights so any help would be much appreciated.
Thanks in advance,
inzo
Thank god for beer!
The current predicament of the week is as follows:
I have two assemblies in a single solution, A and B. Assembly A is an application that installs a context menu into the file system (like that Winzip Icon when you right click on a file). When a user clicks on one of the options to that function, such as "Add this file!", a new object of assembly is instantiated and the method AddFile(filename) is called - then the object is disposed.
The AddFile method simply appends the name of the working file to a text file in the same directory as the calling assembly. If the file does not exist, it creates it. Here is the code I used to get the executing assembly:
Private myassembly As System.Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
Private tempfile As FileInfo = New FileInfo(myassembly.Location)
Private m_filelist As String = tempfile.DirectoryName & "\FileList.txt"
This works great when I compile and run it in V Studio . NEt. The context menu works and the text file gets created when not present. However...when I create an installation package and deploy the app, Im not getting the anticipated result. Everything installs and all .dlls are copied to the program directory. The menu works fine - the only issue I have is that it is writing back to the directory where I compiled the original code for the context menu (assembly A) - as opposed to the application directory.
Does anyone have an idea of why this would happen? When I isolate the Assembly B and call AddFile from a command line app, it works fine when deployed. The issue seems to be in the method I am calling or instantiating an object of class B from Assembly A.
this kept me up many nights so any help would be much appreciated.
Thanks in advance,
inzo