Merge-script not include dot sourced file

I have created a config file for the merge script
config.ps1

@{
  Root       = 'C:\test.ps1' # Root script to package. This is the main entry point for the package. 
  OutputPath = 'C:\bundle' # The output directory for the packaging process. 
  Package    = @{
    Enabled             = $true # Whether to package as an executable. 
    Obfuscate           = $false # Whether to obfuscate the resulting executable. 
    HideConsoleWindow   = $false # Whether to hide the console window.  Only valid for console applications.
    DotNetVersion       = 'v4.6.2' # The target .NET Framework version. You will need the .NET Developer Pack for this version installed on your machine.  
    FileVersion         = '1.0.0' # The output file version
    FileDescription     = '' # The output file description
    ProductName         = '' # The output file product name
    ProductVersion      = '' # The output file product version.
    Copyright           = '' # The output file copyright
    RequireElevation    = $false # Whether to require elevation when running the executable. Only valid for console applications. 
    ApplicationIconPath = '' # The path to the application icon to use for the executable. 
    PackageType         = 'Console' # The type of executable to generate. Valid values are Service or Console. 
    PowerShellCore      = $false # Whether to bundle the PowerShell Core runtime within your executable. 
    HighDPISupport      = $false  # Whether to enable high DPI support for WinForm applications
    PowerShellArguments = '' # Sets the arguments for the PowerShell process that is hosted within the executable. You can use arguments like -NoExit, -ExecutionPolicy and -NoProfile.
  }
  Bundle     = @{
    Enabled = $true # Whether to bundle multiple PS1s into a single PS1. Always enabled when Package is enabled. 
    Modules = $true # Whether to bundle modules into the package
  }
}

The test file is simple
`test1.ps1’

. testFunctions.ps1


Get-ComplexPassword -MinimumPasswordLength 10

testFunctions.ps1

function Get-ComplexPassword
{

  Param
  (
    [Parameter(Mandatory = $True)][Int32]$MinimumPasswordLength
  )
 write-host $MinimumPasswordLength

}

I run the command merge-script -configfile .\config.ps1

It completes

However, when I run the command from powershell .\test.exe

. : The term 'testFunctions.ps1' 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 line:2 char:3
+ . testFunctions.ps1
+   ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (testFunctions.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Get-ComplexPassword : The term 'Get-ComplexPassword' 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 line:3 char:1
+ Get-ComplexPassword -MinimumPasswordLength 10
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-ComplexPassword:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

What is needed to make this basic functionality work properly

That should work. Surprised it doesn’t. I’ll look into it and see if I can fix that issue.

Can you try modifying your script like this:

. "$PSScriptRoot\testFunctions.ps1"

Hi Adam.
Interesting that would actually make a difference. As long as I can get it to work.
Thanks

I’m receiving similar. I’m using the vscode version 5.11.0
image

Merge-Script: File C:\temppath\CDC_FileRename.form.ps1 does not exist.

File most definitely exists. I tried the suggestion Adam posted but the problem recurs.

Disregard. Tried the same script on another computer of mine and it went right through.

Hi,
how to you include psm1 file that contain created classes ?
As with Vscode and Powershell 7 using this to have “class” definition loaded:
using module .\Class\nameoffileClass.psm1

Regards