Up vote 0 down vote favorite share g+ share fb share tw.
I am working on a desktop application for which I need to load the assembly and execute it in different appdomain. For loading the assembly I have written as: public static DataTable GetAllPluginNames(string args) { SqlConnection sConnection = new SqlConnection(ConfigurationSettings. AppSettings"ConnectionString"); //ToDo: create a table of one column - only name of the plugin and return that.
//ToDo: refer the code from MFAssemblyValidator from MFPluggerService. DataTable dt = null; List assemblyNames = new List(); Assembly oAssemblies = new Assemblyargs. Length; for (int assemblyCount = 0; assemblyCount Length; assemblyCount++) { oAssembliesassemblyCount = Assembly.
LoadFile(argsassemblyCount); try { foreach (Type oType in oAssembliesassemblyCount.GetTypes()) { // Check whether class is inheriting from IMFDBAnalyserPlugin. If (oType. GetInterface("IMFDBAnalyserPlugin") == typeof(IMFDBAnalyserPlugin)) { assemblyNames.
Add(argsassemblyCount. Substring(argsassemblyCount. LastIndexOf("\\") + 1)); } } return dt; } catch (Exception ex) { lblError.
Text = "ERROR"; } // Passing data one application domain to another. AppDomain.CurrentDomain. SetData("AssemblyNames", assemblyNames.ToArray()); } } but typeof(IMFDBAnalyserPlugin)) is showing a namespace error.
IMFDBAnalyserPlugin is the interface class in my program as: using System; using System.Collections. Generic; using System. Linq; using System.
Text; namespace MFDBAnalyser { public interface IMFDBAnalyserPlugin { void ExecutePlugin(); } } What might be the problem? Can anyone help me out! C# visual-studio namespaces link|improve this question edited Nov 20 '10 at 9:46Cody Gray48.8k63695 asked Nov 20 '10 at 9:30Srivastava436315 83% accept rate.
If not, you either need to add a using directive to the top of the code file that contains the GetAllPluginNames method, or fully qualify the interface reference with its namespace, i.e. If (oType. GetInterface("MFDBAnalyser.
IMFDBAnalyserPlugin") == typeof(MFDBAnalyser. IMFDBAnalyserPlugin)).
It is not working too.... – Srivastava Nov 20 '10 at 9:46 You'll need to provide the fully-qualified reference for IMFDBAnalyserPlugin each time you use it in your code, unless you opt to add a using directive at the top of your code file. I updated my post with the complete syntax. – Cody Gray Nov 20 '10 at 9:51.
Quick Solution I: In the project properties, change the Dotnet framework from 2.0,3.0 or 3.5 to 4, compile and run! Quick Solution II: Check the . Cs properties – change from content to compile.
More details can be found here.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.