I have a .net core 2.0 console app that does the following (simplified):
var a = Assembly.Load(Assembly.GetEntryAssembly()
.GetRefe
You code will not compile if you use Assembly.LoadFile
way.
I'have created a sample project in Visual studio 2017 community and I was able to step into a function from dynamic assembly by using both Assembly.LoadFile
and Assembly.Load
ways. I did not go with you code since it was not compiling, but i will provide a solution which i think you will solve your problem.
Here is the solution: Full working solution is here https://github.com/beyazc/.netcore-dynamic-assembly-debug
Basicly I was able yo debug with following code. You should press f11 on invoke method
var assemlies = Assembly.GetEntryAssembly().GetReferencedAssemblies();
var assemblyName = "";
foreach (var item in assemlies)
{
if (item.Name == "RefProj")
assemblyName = item.Name;
}
var path = new FileInfo(Assembly.GetExecutingAssembly().Location);
var a = Assembly.LoadFile(Path.Combine($@"{path}\..\..\..\..\..\RefProj\bin\Debug\netstandard2.0", "RefProj.dll"));
var t = a.GetType("RefProj.Class1");
var i = Activator.CreateInstance(t);
MethodInfo mi = t.GetMethod("get1");
mi.Invoke(i, null);