Initially posted this issue in TypeSpec Community
microsoft/typespec#10007
Describe the bug
Hello Team,
I am able to generate the PowerShell module using TypeSpec but build-module.ps1 is failing to build powershell module.
The reason for this failure is incorrect .psd1 file.
in generated .psd1 file functiontoExport is not defined and because of that build fails.
below is sample .psd1 file.
@{
GUID = 'eb86a394-c876-4c7d-b163-c3f93c11834f'
RootModule = './Demo.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Demo cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Demo.private.dll'
FormatsToProcess = './Demo.format.ps1xml'
**FunctionsToExport =**
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Demo'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
Reproduction
- Create tspconfig.yaml
emit:
- "/root/holodeck/node/node_modules/@azure-tools/typespec-powershell"
options:
"/root/holodeck/node/node_modules/@azure-tools/typespec-powershell":
source-file: "../api/src/main/resources/openapi.yml"
service-name: "Holodeck"
module-name: "Holodeck"
is-data-plane: true
# PERMANENT FIX: Force valid PowerShell syntax for exports
additional-psd1-data:
FunctionsToExport: "*"
CmdletsToExport: "*"
-
Run tsp compile .
-
cd generated
-
run build-module.ps1
