The Question
I'm trying to create a PowerShell Core binary cmdlet library that uses SimpleInjector, but cannot figure out why it's resulting in a FileNotFoundException when debugging it with Visual Studio.
Details
I've created a super simple PowerShell cmdlet library in Visual Studio, targeting .NET Standard 2.0 and using the PowerShellStandard.Library package (v5.1.0-RC1). You can view/clone it here. It contains the following cmdlet:
using System.Management.Automation;
using Newtonsoft.Json.Linq;
using SimpleInjector;
[Cmdlet(VerbsDiagnostic.Test, "SimpleInjectorDependency")]
public class TestSimpleInjectorDependencyCmdlet : PSCmdlet
{
protected override void ProcessRecord()
{
var container = new Container();
WriteObject("Success!");
}
}
The result is a FileNotFoundException:
This seems specific to SimpleInjector because doing the same thing with, for example, json.net runs without a problem:
using System.Management.Automation;
using Newtonsoft.Json.Linq;
using SimpleInjector;
[Cmdlet(VerbsDiagnostic.Test, "JsonDotNetDependency")]
public class TestJsonDotNetDependencyCmdlet : PSCmdlet
{
protected override void ProcessRecord()
{
var j = new JObject();
WriteObject("Success!");
}
}
I really don't understand what is happening here. I'm not even sure if this is truly specific to SimpleInjector or if there are other factors at play. If anyone can enlighten me, I'd really appreciate it!



