Skip to content

Commit 1e85b98

Browse files
Template system update
Serialization update for templating to match latest PSFramework version and remove dependency from typeconverter in general
1 parent fb6f54c commit 1e85b98

File tree

14 files changed

+259
-6
lines changed

14 files changed

+259
-6
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Version number of this module.
77

8-
ModuleVersion = '2.2.11.168'
8+
ModuleVersion = '2.2.12.171'
99

1010
# ID used to uniquely identify this module
1111
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'
@@ -28,7 +28,7 @@
2828
# Modules that must be imported into the global environment prior to importing
2929
# this module
3030
RequiredModules = @(
31-
@{ ModuleName = 'PSFramework'; ModuleVersion = '1.7.270' }
31+
@{ ModuleName = 'PSFramework'; ModuleVersion = '1.12.346' }
3232
@{ ModuleName = 'string'; ModuleVersion = '1.1.3' }
3333
)
3434

Binary file not shown.
Binary file not shown.

PSModuleDevelopment/bin/PSModuleDevelopment.xml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PSModuleDevelopment/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.2.12.171 (2024-10-04)
4+
5+
+ Upd: Raised PSFramework dependency due to critical security update
6+
+ Fix: Invoke-PSMDTemplate - fails on non-Windows
7+
+ Fix: Invoke-PSMDTemplate - fails with latest PSFramework version
8+
39
## 2.2.11.168 (2024-05-31)
410

511
+ Upd: Template AzureFunction - added config option to override http Endpoint methods (#198)

PSModuleDevelopment/functions/templating/New-PSMDTemplate.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@
552552

553553
$template.CreatedOn = (Get-Date).Date
554554

555-
$template | Export-Clixml -Path (Join-Path $exportFolder $fileName)
556-
$template.ToTemplateInfo() | Export-Clixml -Path (Join-Path $exportFolder $infoFileName)
555+
$template | Export-PSFClixml -Path (Join-Path $exportFolder $fileName) -Depth 99
556+
$template.ToTemplateInfo() | Export-PSFClixml -Path (Join-Path $exportFolder $infoFileName)
557557
}
558558
}

build/vsts-build-library.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<#
2+
.SYNOPSIS
3+
Builds the PSFramework binary library from source.
4+
5+
.DESCRIPTION
6+
Builds the PSFramework binary library from source.
7+
8+
.PARAMETER WorkingDirectory
9+
Path where the project root is.
10+
Defaults to the parent folder this file is in.
11+
12+
.EXAMPLE
13+
PS C:\> .\vsts-build-library.ps1
14+
15+
Builds the PSFramework binary library from source.
16+
#>
17+
[CmdletBinding()]
18+
param (
19+
$WorkingDirectory
20+
)
21+
22+
#region Handle Working Directory Defaults
23+
if (-not $WorkingDirectory)
24+
{
25+
if ($env:RELEASE_PRIMARYARTIFACTSOURCEALIAS)
26+
{
27+
$WorkingDirectory = Join-Path -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -ChildPath $env:RELEASE_PRIMARYARTIFACTSOURCEALIAS
28+
}
29+
else { $WorkingDirectory = $env:SYSTEM_DEFAULTWORKINGDIRECTORY }
30+
}
31+
if (-not $WorkingDirectory) { $WorkingDirectory = Split-Path $PSScriptRoot }
32+
#endregion Handle Working Directory Defaults
33+
34+
# Build Library
35+
dotnet build "$WorkingDirectory\library\PSModuleDevelopment\PSModuleDevelopment.sln"
36+
if ($LASTEXITCODE -ne 0) {
37+
throw "Failed to build PSModuleDevelopment.dll!"
38+
}

dev/launch.ps1

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ param (
33
[switch]
44
$Local,
55

6+
[switch]
7+
$Build,
8+
69
[ValidateSet('Desktop', 'Core')]
710
[string]
811
$PSVersion
@@ -16,7 +19,10 @@ if (-not $Local) {
1619
if ($PSVersion -eq 'Desktop') { $application = 'powershell.exe'}
1720
}
1821

19-
Start-Process $application -ArgumentList @('-NoExit', '-NoProfile', '-File', "$PSScriptRoot\launch.ps1", '-Local')
22+
$arguments = @('-NoExit', '-NoProfile', '-File', "$PSScriptRoot\launch.ps1", '-Local')
23+
if ($Build) { $arguments += '-Build' }
24+
25+
Start-Process $application -ArgumentList $arguments
2026
return
2127
}
2228
#endregion Launch in new cponsole
@@ -80,10 +86,26 @@ function Import-PsmdModule {
8086
# Does not work during initial start
8187
# [Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory("ipmo '$ProjectPath\PSModuleDevelopment\PSModuleDevelopment.psd1'")
8288
}
89+
90+
function Build-PsmdModule {
91+
[CmdletBinding()]
92+
param (
93+
[Parameter(Mandatory = $true)]
94+
[string]
95+
$ProjectPath
96+
)
97+
98+
Write-Host "Building Library. This may require the .NET 4.8 Targeting Pack"
99+
try { $null = & "$ProjectPath\build\vsts-build-library.ps1" }
100+
catch {
101+
Write-Host "Targeting pack Download Link: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk"
102+
throw
103+
}
104+
}
83105
#endregion Functions
84106

85107
$projectRoot = Resolve-Path -Path "$PSScriptRoot\.."
86108
$templateRoot = New-TemporaryPath -Prefix PsmdTemplate
87-
#Build-PsmdModule -ProjectPath $projectRoot
109+
if ($Build) { Build-PsmdModule -ProjectPath $projectRoot }
88110
Import-PsmdModule -ProjectPath $projectRoot
89111
Build-Template -RootPath $templateRoot -ProjectPath $projectRoot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"RootPath":"F:\\Code\\Github\\PSModuleDevelopment\\library\\PSModuleDevelopment\\PSModuleDevelopment","ProjectFileName":"PSModuleDevelopment.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"Format\\Column.cs"},{"SourceFile":"Format\\Alignment.cs"},{"SourceFile":"Format\\ColumnTransformation.cs"},{"SourceFile":"Format\\Document.cs"},{"SourceFile":"Format\\TableDefinition.cs"},{"SourceFile":"Format\\ViewDefinitionBase.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"PsmdAssembly\\Constructor.cs"},{"SourceFile":"Template\\Parameter\\ParameterBase.cs"},{"SourceFile":"Template\\ParameterScript.cs"},{"SourceFile":"Template\\Parameter\\ParameterPrompt.cs"},{"SourceFile":"Template\\Parameter\\ParameterScript.cs"},{"SourceFile":"Template\\Parameter\\ScriptExecutionTime.cs"},{"SourceFile":"Template\\Store.cs"},{"SourceFile":"Template\\Template.cs"},{"SourceFile":"Template\\TemplateInfo.cs"},{"SourceFile":"Template\\TemplateItemBase.cs"},{"SourceFile":"Template\\TemplateItemFile.cs"},{"SourceFile":"Template\\TemplateItemFolder.cs"},{"SourceFile":"Template\\TemplateResult.cs"},{"SourceFile":"Template\\TemplateType.cs"},{"SourceFile":"Utility\\LinesOfCode.cs"},{"SourceFile":"Utility\\PropertySearchResult.cs"},{"SourceFile":"Utility\\TextAlignment.cs"},{"SourceFile":"Utility\\TextHeader.cs"},{"SourceFile":"Utility\\UtilityHost.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.8.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"F:\\Code\\Github\\psframework\\PSFramework\\bin\\PSFramework.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Windows\\Microsoft.NET\\assembly\\GAC_MSIL\\System.Management.Automation\\v4.0_3.0.0.0__31bf3856ad364e35\\System.Management.Automation.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"F:\\Code\\Github\\PSModuleDevelopment\\PSModuleDevelopment\\bin\\PSModuleDevelopment.dll","OutputItemRelativePath":"PSModuleDevelopment.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}

library/PSModuleDevelopment/PSModuleDevelopment/PSModuleDevelopment.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<Compile Include="Template\Parameter\ScriptExecutionTime.cs" />
6767
<Compile Include="Template\Store.cs" />
6868
<Compile Include="Template\Template.cs" />
69+
<Compile Include="Template\TemplateHost.cs" />
6970
<Compile Include="Template\TemplateInfo.cs" />
7071
<Compile Include="Template\TemplateItemBase.cs" />
7172
<Compile Include="Template\TemplateItemFile.cs" />
@@ -74,6 +75,7 @@
7475
<Compile Include="Template\TemplateType.cs" />
7576
<Compile Include="Utility\LinesOfCode.cs" />
7677
<Compile Include="Utility\PropertySearchResult.cs" />
78+
<Compile Include="Utility\PSObjectExtension.cs" />
7779
<Compile Include="Utility\TextAlignment.cs" />
7880
<Compile Include="Utility\TextHeader.cs" />
7981
<Compile Include="Utility\UtilityHost.cs" />

0 commit comments

Comments
 (0)