I am trying to use Psake to build my Asp.Net MVC Solution on Jenkins Server. I have the Powershell scripts and Psake scripts checked in to source code. I have created a bootstrapper file build.ps1 that imports and invokes Psake.
Import-Module .\Psake.4.5.0\psake.psm1
Invoke-Psake -buildFile .\default.ps1 `
-taskList Default `
-framework '4.6' `
-parameters @{'solutionFilePath'='..\Application.sln'}
All my tasks are defined in the default.ps1 file which I am trying to invoke. Locally when I run the script, the Psake module is imported and everything works. On Jenkins server however I get the following error:
Import-Module : The specified module '.\Psake.4.5.0\psake.psm1' was not loaded
because no valid module file was found in any module directory.At C:\Program
Files (x86)\Jenkins\workspace\Atmosphere\Build\Build.ps1:9 char:1
+ Import-Module .\Psake.4.5.0\psake.psm1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (.\Psake.4.5.0\psake.psm1:S
tring) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
I am new to Jenkins, having used Team City previously and I have double checked that the Psake module is indeed being copied to the Jenkins Workspace.
This is how I am invoking the Build.ps1 from Jenkins
Powershell.exe -noprofile -executionpolicy Bypass -file .\Build\Build.ps1
Can someone please point me to what I am doing wrong?