I want to use in my powershell a interface from my custom .net library, but i got always this error:
class Logger : Systems.SysBiz.BaseTransversal.ILoggerBl
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [Systems.SysBiz.BaseTransversal.ILoggerBl].
If I use for example the IComparable interface from the system namespace it works fine.
[System.Reflection.Assembly]::LoadFile('MyPath\BaseTransversal.dll')
class Logger : Systems.SysBiz.BaseTransversal.ILoggerBl
{
[bool] $SendMailException = $false;
Logger()
{
}
[void] LogFatal([string] $message, [object[]] $args)
{
Write-Host $message;
}
[void] LogException([System.Exception] $ex, [string] $message, [object[]] $args)
{
Write-Host $this.FormatException($ex);
}
[void] LogError([string] $message, [object[]] $args)
{
Write-Host $message;
}
[void] LogWarning([string] $message, [object[]] $args)
{
Write-Host $message;
}
[void] LogInfo([string] $message, [object[]] $args)
{
Write-Host $message;
}
[void] LogTrace([string] $message, [object[]] $args)
{
Write-Host $message;
}
[void] LogDebug([string] $message, [object[]] $args)
{
Write-Host $message;
}
[string] FormatException([System.Exception] $ex)
{
if (!$ex)
{
return "";
}
return "<br/><b>" + $ex.Message + "</b><p>" + $ex.StackTrace + "</p><br/>" + $this.FormatException($ex.InnerException);
}
}
Here my .net interface
namespace Systems.SysBiz.BaseTransversal
{
public interface ILoggerBl
{
bool SendMailException { get; }
void LogFatal(string message, params object[] args);
void LogException(Exception ex, string message, params object[] args);
void LogError(string message, params object[] args);
void LogWarning(string message, params object[] args);
void LogInfo(string message, params object[] args);
void LogTrace(string message, params object[] args);
void LogDebug(string message, params object[] args);
string FormatException(Exception ex);
}
}
UPDATE: Added full class powershell code I have also tried with a empty interface in my .net code but looks like the i can't see/use my interfaces even they are public. Did I miss something
UPDATE 2: Added exact error