I am trying to access an exe which is in different folder and invoke a method through this using assembly with the following code. This part of the code is in one project
Assembly assembly = Assembly.LoadFrom("D:\\abc\\def\\Test\\test_1\\bin\\Debug\\TestEngine.exe");
Type type2 = assembly.GetType("Test.Program");
object instance = Activator.CreateInstance(type2);
MethodInfo[] methods = type2.GetMethods();
object[] staticParameters = new object[1];
staticParameters[0] = "";
object result = methods.Where(a => a.Name == "Implementation").First().Invoke(instance, staticParameters);
Please note : i can access the method through the where condition but it is not invoking the method and the method i want to access is having code. And this part of the code is in different project folder
public static void Implementation(string input)
{
some code here
}
BUT it is giving me error
'Exception has been thrown by the target of an invocation.' inner exeception : NullReferenceException: Object reference not set to an instance of an object.'
please note : I need to load through assembly only and process.start din't work for me.