Problem getting basic simple build script to work #207
Replies: 2 comments
-
As the information message tells, you have redefined tasks:
Task BuildPSD1 -inputs $sourceFileInfos -Outputs $GeneratedManifestFilePath { ...
Task BuildPSD1 BuildPSM1
Task BuildPSM1 -Inputs $sourceFileInfos -Outputs $GeneratedModuleFilePath { ...
Task BuildPSM1 Clean This is not a build error as such because in rare cases an author wants to redefine tasks. Thus, unless you deliberately redefine tasks (unlikely per the code), it's the bug. Remove these lines or use different task names: Task BuildPSD1 BuildPSM1
Task BuildPSM1 Clean |
Beta Was this translation helpful? Give feedback.
-
Ah! As expected, a simple misunderstanding on my part. I'm past the first hurdle, now on to writing more complex tasks. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
I'd like to use Invoke-Build as the core build script for the powershell modules in my public MIT-licensed GitHub Repository, which is a large monorepo with multiple Powershell modules. But I can't get a basic simple build script to run. The simple script is below. It has an Enter-Build scriptblock, and three simple tasks (they just log the task entry). The output says that two of the tasks are redeneid. I can't figure out why. I must be making some kind of simple mistake, but I've spent a few days now with no success.
if it matters, most of my scripts in my repro DO expect/use $PSDefaultParameterValues as follows:
invoke-build produces the following output:
.\ATAP.Utilities.BuildTooling.PowerShell\ > invoke-build -ModuleRoot .
Build . \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell\module.build.ps1
Redefined task 'BuildPSM1'.
Redefined task 'BuildPSD1'.
Task /./BuildPSD1/BuildPSM1/Clean
Done /./BuildPSD1/BuildPSM1/Clean 00:00:00.0030836
Done /./BuildPSD1/BuildPSM1 00:00:00.0034365
Done /./BuildPSD1 00:00:00.0036953
Done /. 00:00:00.0039474
Build succeeded. 4 tasks, 0 errors, 0 warnings 00:00:00.0289462
invoke-build with the -debug flag produces the following output:
invoke-build -ModuleRoot . -debug
Build . \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell\module.build.ps1
Redefined task 'BuildPSD1'.
Redefined task 'BuildPSM1'.
DEBUG: 19 | [22:30:30][] Starting Module.Build.ps1; Configuration = Production; BuildRoot = \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell; Encoding = UTF8
DEBUG: 39 | [22:30:30][] ModuleRoot = .; moduleName = ATAP.Utilities.BuildTooling.PowerShell
DEBUG: 40 | [22:30:30][] sourceFileInfos = <large number of (correct) full file paths>
DEBUG: 41 | [22:30:30][] sourceManifestPath = .\ATAP.Utilities.BuildTooling.PowerShell.psd1; GeneratedModuleFilePath = ._generated\ATAP.Utilities.BuildTooling.PowerShell.psm1; GeneratedManifestFilePath = ._generated\ATAP.Utilities.BuildTooling.PowerShell.psd1;
Task /./BuildPSD1/BuildPSM1/Clean
DEBUG: 49 | [22:30:30][] Starting Task Clean; Configuration = Production; BuildRoot = \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell; Encoding = UTF8
DEBUG: 50 | [22:30:30][] OriginalLocation = \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell; BuildFile = \GitHub\ATAP.Utilities\src\ATAP.Utilities.BuildTooling.PowerShell\module.build.ps1
DEBUG: 51 | [22:30:30][] WhatIf:False; -Verbose:SilentlyContinue; -Confirm:High
Done /./BuildPSD1/BuildPSM1/Clean 00:00:00.0033031
Done /./BuildPSD1/BuildPSM1 00:00:00.0035807
Done /./BuildPSD1 00:00:00.0038189
Done /. 00:00:00.0040739
Build succeeded. 4 tasks, 0 errors, 0 warnings 00:00:00.0294895
This shows that the 'Enter-Build' script and the 'Clean' task both ran, but the other two tasks did not run.
Help, Please?
I am using the latest versions of VSC (1.73.1), Powershell (7.3.0), Powershell VSC Extension (11/19/2022), and Invoke-Build (5.10.1) on Windows 10.0.22000 (Windows 11)
Module.Build,ps1:
Beta Was this translation helpful? Give feedback.
All reactions