Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yoke88 opened this issue Feb 24, 2018 · 0 comments

Comments

@yoke88
Copy link

yoke88 commented Feb 24, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants