Trouble adding a Workflow Activity to the Toolbox from a PowerShell Script -


i’m creating powershell script (for nuget) can add system.activities workflow activities toolbox.

currently i’m installing them c# code written cmdlet causes problems when try uninstall package since nuget has assembly loaded , can’t deleted.

my goal powershell don’t have load assembly. i’m close except last line add toolbox item blows "object must implement iconvertible." leads me believe thinks i’m passing wrong type.. know $toolbox interface working because add tab toolbox.

function addactivity (  [string] $activity,  [string] $assemblyfullname,   [string] $name,   [string] $category,  [string] $bitmappath) {     write-host "argument list"     write-host $activity     write-host $assemblyfullname      write-host $name       write-host $category      write-host $bitmappath      write-host "loading assemblies"     $assembly = [reflection.assembly]::load("microsoft.visualstudio.shell.interop")      write-host "get toolbox service"     write-host "get toolbox service"     $servicetype = [system.type]::gettype("microsoft.visualstudio.shell.interop.svstoolbox,{0}" -f $assembly.fullname)           $interfacetype = [system.type]::gettype("microsoft.visualstudio.shell.interop.ivstoolbox,{0}" -f $assembly.fullname)      $toolbox = get-vsservice $servicetype $interfacetype          write-host "add tab"     $tlboxtab = $toolbox.addtab($category)      write-host "create dataobject"     $dataobject = new-object microsoft.visualstudio.shell.oledataobject     $dataobject.setdata("assemblyname", $assemblyfullname)     $dataobject.setdata("cf_workflow_4", $name)      $dataobject.setdata("workflowitemtypenameformat", ('{0}{1}' -f $activity, $assemblyfullname))      write-host "load bitmap {0}" $bitmappath     write-host "$bitmappath"     $bitmap = new-object system.drawing.bitmap $bitmappath      $toolboxiteminfo = new-object microsoft.visualstudio.shell.interop.tbxiteminfo;     $toolboxiteminfo.bstrtext = $name     $toolboxiteminfo.hbmp = $bitmap.gethbitmap()     $toolboxiteminfo.clrtransparent = [system.uint32][system.drawing.colortranslator]::towin32([system.drawing.color]::white)      #create array 1 element     $tbiarray = [microsoft.visualstudio.shell.interop.tbxiteminfo[]] ($toolboxiteminfo)      write-host "add item - blow up"     $toolbox.additem($dataobject, $tbiarray, $category)       # exception calling "additem" "3" argument(s): "exception calling "invokemethod" "3" argument(s): "object must implement iconvertible.""     # @ c:\users\rojacobs\documents\visual studio 2010\projects\workflowconsoleapplication24\packages\microsoft.activities.1.8.4.630\tools\install.ps1:53 char:21     # +     $toolbox.additem <<<< ($dataobject, $tbiarray, $category)         #     + categoryinfo          : notspecified: (:) [], methodinvocationexception     #     + fullyqualifiederrorid : scriptmethodruntimeexception } 

ron, believe issue may surrounding category. according documentation looked @ category needs localized name (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivstoolbox.additem.aspx) can recover using getidoftab (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivstoolbox3.getidoftab.aspx).

let me know if helps.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -