start-studioShell.ps1 from nuget

Apr 27, 2011 at 1:19 PM

I want to use the StudioShell functionality from the NuGet host.

In order to be able to find start-studioShell.ps1 I have to open and let initialize the StudioShell console window first.

Even if I call start-StudioShell.ps1 with its full path "C:\Program Files (x86)\Code Owls LLC\StudioShell\Scripts\start-studioShell.ps1" it does not work, because the following lines don't work yet, the module path is not set yet:

import-module studioshell;
. invoke-studioShellProfile.ps1;

If I start the StudioShell window and then call start-StudioShell.ps1 I get an error the first time, and it works the second time, see output below.

Any ideas on how to correctly start StudioShell functionality from the nuget host?

PM> start-studioShell.ps1
testing for presence of StudioShell add-in...
local module root path is C:\Program Files (x86)\Code Owls LLC\StudioShell\Module\studioshell
connecting to StudioShell add in instance
generating module commands
StudioShell
Copyright (c) 2011 Code Owls LLC, All Rights Reserved.
Import-Module : Cannot overwrite variable dte because it is read-only or constant.
At C:\Program Files (x86)\Code Owls LLC\StudioShell\Scripts\start-studioShell.ps1:18 char:14
+ import-module <<<<  studioshell;
    + CategoryInfo          : WriteError: (dte:String) [Import-Module], SessionStateUnauthorizedAccessException
    + FullyQualifiedErrorId : VariableNotWritable,Microsoft.PowerShell.Commands.ImportModuleCommand
 
skipping StudioShell profile load because no settings could be loaded
PM> start-studioShell.ps1
testing for presence of StudioShell add-in...
local module root path is C:\Program Files (x86)\Code Owls LLC\StudioShell\Module\studioshell
connecting to StudioShell add in instance
generating module commands
StudioShell
Copyright (c) 2011 Code Owls LLC, All Rights Reserved.
skipping StudioShell profile load because no settings could be loaded
PM>

Coordinator
May 3, 2011 at 4:35 PM

we are actually working on a studioshell nuget package which will help resolve these errors.  Hoping to release in the next week or so.

 

May 3, 2011 at 9:17 PM

It would be great if you would support execution of PowerShell code from a menu item in the nuget PowerShell host as well... (http://studioshell.codeplex.com/discussions/255413)

Thanks for the great work!

Coordinator
Jun 6, 2011 at 5:26 PM

That's the plan.  It's also the hardest part to get working :)  Thanks for all of your input on this!