Just getting started with Octopus and would find it useful to load the client assembly into powershell for scripting. Having some trouble. Any advice?
Sure, here’s an example (the details are valid, you should actually be able to execute this and see machines):
Thanks Paul. That’s what I tried originally but I get an error
Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
I was thinking this was an issue with loading the dependent libraries that get pulled down with the client package. I pulled it down to a standalone directory using nuget.exe. I tried dumping everything together in the same directory but that didn’t seem to help. If I load everything from nuget in visual studio everything works properly. Any suggestions? Thanks for your help. So far we’re really loving Octopus. You probably have a new customer coming on board shortly.
Yeah, dug into the exception and it looks like it’s throwing when it’s trying to find the newtonsoft.json assembly. I’ll try loading that first and see what I get.
I believe this is the issue. If I load the assembly using [reflection.assembly]::loadfile() I get
Assembly : Newtonsoft.Json, Version=220.127.116.11, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The exception being thrown is looking for this
File name: ‘Newtonsoft.Json, Version=18.104.22.168, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’
Is this an incorrect reference in the Octopus.Client package? Is my powershell being weird? Thanks again
ok I loaded Newtonsoft.Json.4.5.11 package and then loaded that into PS first and now I am good to go. I talked to a real developer and I guess my visual studio project works because nuget automatically binds to the down level versions.
Thanks for the follow-up; unfortunately a bit of a pain point when working outside of VS these days. Glad it is sorted out!
Loading Newtonsoft.Json.dll from Newtonsoft.Json.X package worked for me.
For the lazy fellas:
Add-Type -Path ".\Newtonsoft.Json.dll"
Add-Type -Path “.\Octopus.Client.dll”