Rijndael256 icon indicating copy to clipboard operation
Rijndael256 copied to clipboard

add-type A namespace cannot directly contain members such as fields or methods

Open yoke88 opened this issue 7 years ago • 0 comments

when using powershell core to add-type like this:

$modulepath= Resolve-Path -path "$PSScriptRoot\lib\netstandard1.3\Rijndael256.dll"

add-type $modulepath

function Encrypt-Rijndael256{
    param(
        $key,
        $plaintext
    )

    return [Rijndael256.Rijndael]::Encrypt($plaintext,$key,256)
}

function Decrypt-Rijndael256{
    param(
        $key,
        $encryptText
        
    )
    return [Rijndael256.Rijndael]::Decrypt($encryptText,$key,256)
}

### i always got error like this.

add-type : (1) : Type or namespace definition, or end-of-file expected
(1) : >>> /home/yoke/Documents/PSPHPIPAM/functions/lib/netstandard1.3/Rijndael256.dll
At /home/yoke/Documents/PSPHPIPAM/functions/Rijndael256.core.ps1:3 char:1
+ add-type $modulepath
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

maybe the below link can show what's wrong there here

yoke88 avatar Feb 24 '18 04:02 yoke88