*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build:
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 1803
32 or 64 bit OS: 64 bit
Ok. So this problem caused me a lot of grief yesterday and today while I was trying to troubleshoot why a powershell module I had created was not working. I have a powershell module which is comprised of powershell scripts which are dot sourced into the current session when the module is imported. The psm1 file contains the below code:
The problem that I am running into is with the manifest file, which Sapien powershell studio seems to not be able to resist the compulsion to change certain properties when I have set values for them. The property in question is the "FunctionsToExport" property. Even when I go into the manifest file and define the functions which are to be exported (with either the names of the functions or a simple "*" wildcard), powershell studio keeps changing the property back to an empty array when I use the deploy feature to deploy the module to its final destination (the changes are made to both the deployed manifest file and the manifest file in the project). This requires that I, upon deploying the powershell module, open the manifest file when the folder I deployed to opens in explorer and manually configure the FunctionsToExport property EVERY SINGLE TIME I deploy the module since, like I said, powershell studio can't seem to control its compulsive, destructive behavior when it comes to my project files. The module itself does work if all I wanted to do was import it into the current powershell session. But that is not what I am trying to do. I built this module specifically for the purpose of creating, testing, and showcasing a continuous integration powershell pipeline, and when the above property is an empty array as a result of Powershell studio's unnecessary/compulsive modification of the manifest file, the pipeline does not find any of the functions associated with the module. Please fix this, or at least have a "don't screw with my powershell files Powershell Studio" option somewhere.
Code: Select all
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $env:USER, (ConvertTo-SecureString $env:PASSWORD -Force -AsPlainText)
Connect-AzureRmAccount -Credential $cred -TenantId $env:TENANT -ServicePrincipal
$ModuleRoot = $PSScriptRoot
$funcs = @(Get-ChildItem -Path "$PSScriptRoot\Functions\*.ps1" -ErrorAction SilentlyContinue)
foreach ($import in $funcs)
Write-Error -Message "Failed to import function $($import.fullname): $_"
Export-ModuleMember -Function $funcs.Basename
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM