I have a solution for web applications (let's say in C:\WebApp
). At some point, I need to add an external DLL from another solution ( C:\Custom
) and call the method in it.
I am using this code:
public ActionResult ExecuteCustomAction()
{
Assembly assembly = Assembly.LoadFile(@"C:\Custom\Custom\bin\Debug\Custom.dll");
Object o = assembly.CreateInstance("Custom.Custom");
if (o != null)
{
MethodInfo method = o.GetType().GetMethod("Execute");
Object[] ob =
if (method != null)
{
Object returnValue = method.Invoke(o, ob).ToString();
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
}
return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
}
No problem so far.
I would like to be able to debug the called method (the custom solution is open in another VS instance), but failed.
I disabled the option "Only my code", Debug / Windows / Modules shows that the characters for Custom.dll are loaded correctly, I can connect both VS instances (WebApp VS and Custom VS) to the process w3wp
, but the execution never stops at the breakpoint, which I put inside the method Execute
.
I am not familiar with this, have I missed something obvious?
EDIT: , bin , .