G
Guest
I have a text file which contains VB.NET code. The VB.NET code is actually a
Class that can contain code, which simply displays a message box or does
something more complicated (i.e Excel/Word Automation, communicate with the
DB and/or WebServices, talk to other classes). To achieve a complicated task,
this class would need reference to other custom assemblies (not part of .net
framework) that are possibly not installed to the GAC.
In my application, I use the System.CodeDom.Compiler.ICodeCompiler's
CompileAssemblyFromSource method to compile the text file code into an
assembly. Before the new assembly is created, I use the
ReferencedAssemblies.Add method to add reference to all the DLL files needed
by it. The ReferencedAssemblies.Add method is given the full path to a DLL
file, but the full path is a directory other than the main application's App
Direcotry(=where the Main.Exe is run from). For assemblies that are in the
GAC (such as System.dll and System.Windows.Forms.dll) this works fine; the
text file source code compiles without errors and I can call its methods,
etc. When adding reference, a full path is also specified for custom dll
files, but I get an FileNotFoundException. If I place the Custom Dll files
int the App Directory I do not get an exception and the source code compiles,
but this is not a feasible option.
I've tried setting the CompilerOptions parameter to the full path from
above, but that directory is not even probed. The property is set as follows:
cpCompilerParameters.CompilerOptions = "/lib:\Reports\CustomFiles\". Is
this the correct way of doing it?
Are there any other mechanisms by which I can tell the Main application
where to probe for these custom dlls?
Thanks for your help.
Norm
Class that can contain code, which simply displays a message box or does
something more complicated (i.e Excel/Word Automation, communicate with the
DB and/or WebServices, talk to other classes). To achieve a complicated task,
this class would need reference to other custom assemblies (not part of .net
framework) that are possibly not installed to the GAC.
In my application, I use the System.CodeDom.Compiler.ICodeCompiler's
CompileAssemblyFromSource method to compile the text file code into an
assembly. Before the new assembly is created, I use the
ReferencedAssemblies.Add method to add reference to all the DLL files needed
by it. The ReferencedAssemblies.Add method is given the full path to a DLL
file, but the full path is a directory other than the main application's App
Direcotry(=where the Main.Exe is run from). For assemblies that are in the
GAC (such as System.dll and System.Windows.Forms.dll) this works fine; the
text file source code compiles without errors and I can call its methods,
etc. When adding reference, a full path is also specified for custom dll
files, but I get an FileNotFoundException. If I place the Custom Dll files
int the App Directory I do not get an exception and the source code compiles,
but this is not a feasible option.
I've tried setting the CompilerOptions parameter to the full path from
above, but that directory is not even probed. The property is set as follows:
cpCompilerParameters.CompilerOptions = "/lib:\Reports\CustomFiles\". Is
this the correct way of doing it?
Are there any other mechanisms by which I can tell the Main application
where to probe for these custom dlls?
Thanks for your help.
Norm