Menu item executing in non-StudioShell host

Apr 27, 2011 at 11:03 AM

Scenario:

have a nuget package referenced by my project with init.ps1 script that get executed on loading solution.

The init.ps1 script does the following:

  • function DoIt { write-host "I did it!" }
  • start-studioshell.ps1 (or import-module studioshell)
  • new-item dte:\commandbars\menubar\tools -name "Serge WriteHost Test" -Value { Write-Host "hello world" }
  • new-item dte:\commandbars\menubar\tools -name "Serge Execute Command" -Value { new-item dte:\commandbars\menubar\tools -name "Serge's from command generated menu item" }
  • new-item dte:\commandbars\menubar\tools -name "Serge NuGetHost Function Test" -Value { DoIt }

I don't get this to work, menu entries made from the NuGet console appear, but their action does not work.

Any ideas on how to execute actions in the NuGet context?