Building from source

Topics: Developer Forum
Oct 20, 2011 at 5:01 PM

Hi,

I just downloaded the source and compiled it (using VS 2010).  Then I copied the Debug folder to my Modules directory and named it Pscx.  When I try to load the module I get the usual signing errors.  Even when I set the execution policy to unrestricted, I still get a large number of dialogs from PS that I need to click on.  Obviously, this is not a viable development setup.  How do you guys do it?  (Btw, I am a relative newbie to PS.)

Thanks.

Coordinator
Oct 20, 2011 at 6:33 PM

The PSCX developers usually don't download the source, we "get" it via the TFS Team Explorer plugin for Visual Studio 2010 (or we're using a VS 2010 SKU that has it built-in).  Since you downloaded the source, you may need to unblock all the files.  There's an Unblock-File command in PSCX that will do that. So you may need to bootstrap by extracting the PSCX ZIP to your modules folder (don't forget to use Windows Explorer -> Properties to Unblock the ZIP before extracting any files from it).

Oct 21, 2011 at 3:22 AM

Thanks Keith.  I have now checked out Trunk (via subversion) and I get an error from the help project:

------ Build started: Project: PscxHelp, Configuration: Debug Any CPU ------
  File C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Scripts\GeneratePscxHelpXml.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
  At line:1 char:34
  + .\Scripts\GeneratePscxHelpXml.ps1 <<<<  .\Output\ C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Help Debug
      + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
      + FullyQualifiedErrorId : RuntimeException
   
C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\PscxHelp.csproj(171,5): error MSB3073: The command "PowerShell.exe -NoProfile -Command .\Scripts\GeneratePscxHelpXml.ps1 .\Output\ C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Help Debug" exited with code 1.

However, when I execute the command directly from cmd.exe it works fine:

C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp>PowerShell.exe -NoProfile -Command .\Scripts\GeneratePscxHelpXml.ps1 .\Output\ C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Help Debug
Processing C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Provider_AssemblyCache.xml
Processing C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Provider_DirectoryServices.xml
Processing C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Provider_Feedstore.xml

My execution policy is set to unrestricted. Any idea what's wrong?

Thanks.

Oct 21, 2011 at 3:51 AM
Edited Oct 23, 2011 at 1:51 AM

Turns out that VS calls a different PS; see http://stackoverflow.com/questions/2066724/msbuild-calling-powershell-script-under-windows-7-gets-signing-error which fixed my problem.

I have two further questions:

  1. I get a non-fatal error during help compilation.  Here is a snippet of the output: 
    Processing rf
      Get-Command : The term 'Invoke-Reflector' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At C:\Stuff\PowerShellCommunityExtensions\Src\PscxHelp\Scripts\GenerateAboutPsxcHelpTxt.ps1:184 char:12
      + get-command <<<<  $alias.Definition | %{$_.CommandType.ToString().ToLower()}
          + CategoryInfo          : ObjectNotFound: (Invoke-Reflector:String) [Get-Command], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
       
      Processing rver
    
  2. Once you have built the solution, how do you get PS to load the module?  The output is in Src\Pscx\bin\Debug but an ipmo C:\Stuff\PowerShellCommunityExtensions\Src\Pscx\bin\Debug generates an error -- "The specified module 'C:\Stuff\PowerShellCommunityExtensions\Src\Pscx\bin\'  was not loaded because no valid module file was found in any module directory."

Again, thanks for your help.