I have got a simple class libary project in visual studio:
using System;
using System.Linq;
using System.Management.Automation;
namespace EdoX_auslesen_xml
{
[Cmdlet(VerbsCommon.Get, "DemoNames")]
public class Get_DemoNames : Cmdlet
{
[Parameter(Mandatory = false)]
public string Prefix;
protected override void ProcessRecord()
{
var names = new string[] { "Chris", "Charlie", "Anne" };
if (string.IsNullOrEmpty(this.Prefix))
{
this.WriteObject(names, true);
}
else
{
var prefixed_names = names.Select(n => this.Prefix + n);
this.WriteObject(prefixed_names, true);
}
}
}
}
When I open PowerShell an try to "Get-DemoNames" an error occurs:
in English:
Get-DemoNames: the file or assebly "System.Runtime, Version=4.2.0.0. Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" or a dependency of it was not found. The system cannot find the given file. In line:1 sign:1 + Get- DemoNames...