Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psake VSTS Extension cannot find psake module #7

Open
Matticusau opened this issue Feb 19, 2018 · 2 comments
Open

Psake VSTS Extension cannot find psake module #7

Matticusau opened this issue Feb 19, 2018 · 2 comments

Comments

@Matticusau
Copy link

Been using Psake locally for a while but looking to setup CI/CD for my PowerShell Modules and found the Psake Extension. However when I point that at my build.psake.ps1 script it fails due to being unable to locate the psake module as per the requires tag. I think I got the build.psake.ps1 script from a scaffolding with Plaster, just not sure if I should be writing my own custom script to wrap the build.psake.ps1 or not, but then why would I use the psake extension as I could just use the PowerShell task as I already have done and it works.

2018-02-19T01:06:43.0230747Z ##[section]Starting: psake build.psake.ps1 Build
2018-02-19T01:06:43.0499446Z ==============================================================================
2018-02-19T01:06:43.0499708Z Task         : Psake
2018-02-19T01:06:43.0499904Z Description  : Build with the psake build system
2018-02-19T01:06:43.0500112Z Version      : 5.0.0
2018-02-19T01:06:43.0500480Z Author       : Guillaume Rouchon
2018-02-19T01:06:43.0500710Z Help         : v5.0.0, [More Information](https://github.com/psake/psake-vsts#readme)
2018-02-19T01:06:43.0500947Z ==============================================================================
2018-02-19T01:06:52.0386297Z psake version 4.7.0
2018-02-19T01:06:52.0386885Z Copyright (c) 2010-2017 James Kovacs & Contributors
2018-02-19T01:06:52.0387100Z 
2018-02-19T01:06:52.9198223Z Error: 2/19/2018 1:06:52 AM: 
2018-02-19T01:06:52.9198672Z At D:\a\_tasks\psake_a5a8cf40-b907-4f57-9d89-8d34034c3f97\5.0.0\ps_modules\psake\private\ExecuteInBuildFileScope.ps1:33 char:7
2018-02-19T01:06:52.9199004Z  +     . $psake.build_script_file.FullName
2018-02-19T01:06:52.9199324Z  +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: The script 'build.psake.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: psake.
2018-02-19T01:06:53.2095252Z ##[error]Invoke-psake exited with build_success 'False'.
2018-02-19T01:06:53.2490951Z ##[section]Finishing: psake build.psake.ps1 Build
@qetza
Copy link
Member

qetza commented Feb 19, 2018

Hi Matt,
The extension just contains the psake module and a bootstrap script to load the module and call Invoke-psake on your script. It seems that the #requires command doesn't find the loaded psake module.

I will try to do some testing to understand why.

@Matticusau
Copy link
Author

Thanks @qetza I wasn't sure if I was doing something wrong or had missed something. If you need details of the build.psake.ps1 script I am using I can share it with you but I checked and it came from the Powershell/Plaster templates. Like you have called out though it seems to be an issue with the #requires statement and validating the psake module loaded in the extension.

What I did for the time being is a simple PowerShell task to run the following, but I would really like to use the Psake extension as it looks awesome

# Install NuGet
if ($null -eq (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue))
{
    Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
}

# Install the required modules
if ($null -eq (Get-Module -Name Pester -ListAvailable -ErrorAction SilentlyContinue))
{
    Install-Module -Name Pester -Force -Verbose -Scope CurrentUser -SkipPublisherCheck;
}
if ($null -eq (Get-Module -Name Psake -ListAvailable -ErrorAction SilentlyContinue))
{
    Install-Module -Name Psake -Force -Verbose -Scope CurrentUser;
}

# run Psake Build
Invoke-PSake $PSScriptRoot\build.psake.ps1 -taskList Build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants