I have a .NET Core DLL project that uses a connected service to reference the popular SOAP API. Access to the SOAP API and all its functions work fine.
In this project, I have a Scripty .csx script file that loads an already built DLL and iterates over the types that it provides. The code looks something like this:
var assemblyPath = Path.Combine("fullPathTo.dll");
if (!File.Exists(assemblyPath)) return;
var assembly = Assembly.LoadFile(assemblyPath);
if (assembly != null)
{
Output.WriteLine("// " + assembly.FullName);
try
{
foreach (var type in assembly.GetTypes())
{
Output.WriteLine("// " + type.FullName);
}
}
catch (ReflectionTypeLoadException e)
{
Output.WriteLine($"/* {string.Join<Exception>("\r\n", e.LoaderExceptions)} */ ");
}
Loading the assembly works just fine, but the line for assembly.GetTypesfails with the following exception:
System.IO.FileNotFoundException: "System.ServiceModel.Primitives, Version = 4.1.1.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" . . : 'System.ServiceModel.Primitives, Version = 4.1.1.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'
System.ServiceModel.Primitives( v4.3.0 4.1.0, ). . ?