Load and use .NET Box V2 assemblies from Powershell
Hi,
I am trying to do a simple test to see if you can load the Box.V2.Core assembly rom the .NET SDK fusing Powershell, create an object and then call a method.
What I did:
1) I nuget install-package'd all the Box .NET SDK stuff into a local folder
2) Wrote a simple powershell script to load the assembly and create an object
$BoxV2 = ".\Box.V2.2.14.0\lib\portable-net40+sl50+win+wp80\Box.V2.dll" [System.Reflection.Assembly]::LoadFrom($BoxV2) # get a Box Obj $boxobj = New-Object -TypeName 'Box.V2.Config'
The assembly loads fine, with the following result
GAC Version Location
--- ------- --------
False v4.0.30319 C:\Users\wsstewart\Documents\box\Box.V2.2.14.0\lib\por...
but the object instansiation fails with
New-Object : Cannot find type [Box.V2.Config]: verify that the assembly containing this type is loaded. At C:\Users\wsstewart\Documents\box\box.ps1:11 char:11 + $boxobj = New-Object -TypeName 'Box.V2.Config' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentExcepti on + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewOb jectCommand
What am I doing wrong? Is this even possible to use the SDK via powershell (with the assemblies installed to a local dir via nuget install-package)?
Please sign in to leave a comment.
Comments
0 comments