From 771c399d45fc24805e5315b18ee268d8877fc3e5 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Mon, 28 Apr 2025 20:16:01 -0400 Subject: [PATCH] Include Newtonsoft.Json dependency in the module --- Module/PSProxmox.psd1 | 5 +++-- PSProxmox/PSProxmox.Main.csproj | 8 +++++++- Scripts/Install-PSProxmox.ps1 | 1 + Scripts/build.ps1 | 10 ++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Module/PSProxmox.psd1 b/Module/PSProxmox.psd1 index 3807cad..f9b4475 100644 --- a/Module/PSProxmox.psd1 +++ b/Module/PSProxmox.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'PSProxmox.dll' - ModuleVersion = '2025.04.28.1958' + ModuleVersion = '2025.04.28.2015' GUID = 'd24f0894-3d0c-4ef1-a41e-b273c3db86ad' Author = 'PSProxmox Team' CompanyName = 'PSProxmox' @@ -10,7 +10,7 @@ DotNetFrameworkVersion = '4.7.2' CompatiblePSEditions = @('Desktop', 'Core') # Assemblies that must be loaded prior to importing this module - RequiredAssemblies = @('bin\PSProxmox.dll') + RequiredAssemblies = @('bin\PSProxmox.dll', 'bin\Newtonsoft.Json.dll') # Script files (.ps1) that are run in the caller's environment prior to importing this module ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module @@ -91,3 +91,4 @@ + diff --git a/PSProxmox/PSProxmox.Main.csproj b/PSProxmox/PSProxmox.Main.csproj index 769815b..1e32fa8 100644 --- a/PSProxmox/PSProxmox.Main.csproj +++ b/PSProxmox/PSProxmox.Main.csproj @@ -17,7 +17,9 @@ - + + All + @@ -95,4 +97,8 @@ + + true + + diff --git a/Scripts/Install-PSProxmox.ps1 b/Scripts/Install-PSProxmox.ps1 index 322fba2..75d3645 100644 --- a/Scripts/Install-PSProxmox.ps1 +++ b/Scripts/Install-PSProxmox.ps1 @@ -29,6 +29,7 @@ if (-not (Test-Path -Path "$modulePath\bin")) { # Copy the module files Copy-Item -Path "$rootPath\Module\PSProxmox.psd1" -Destination $modulePath -Force Copy-Item -Path "$rootPath\Module\bin\PSProxmox.dll" -Destination "$modulePath\bin" -Force +Copy-Item -Path "$rootPath\Module\bin\Newtonsoft.Json.dll" -Destination "$modulePath\bin" -Force Copy-Item -Path "$rootPath\LICENSE" -Destination $modulePath -Force Copy-Item -Path "$rootPath\README.md" -Destination $modulePath -Force diff --git a/Scripts/build.ps1 b/Scripts/build.ps1 index 9572862..9c15de4 100644 --- a/Scripts/build.ps1 +++ b/Scripts/build.ps1 @@ -43,10 +43,20 @@ Copy-Item -Path "$rootPath\LICENSE" -Destination $releaseVersionDir -Force Copy-Item -Path "$rootPath\README.md" -Destination $releaseVersionDir -Force Copy-Item -Path "$scriptRoot\Install-PSProxmox.ps1" -Destination $releaseVersionDir -Force +# Make sure the bin directory exists in the release directory +if (-not (Test-Path -Path "$releaseVersionDir\bin")) { + New-Item -Path "$releaseVersionDir\bin" -ItemType Directory -Force | Out-Null + Write-Host "Created bin directory in release: $releaseVersionDir\bin" +} + # Copy the fully prepared module back to the Module directory Write-Host "Updating Module directory with built files..." Copy-Item -Path "$releaseBinDir\PSProxmox.dll" -Destination "$rootPath\Module\bin" -Force +# Copy dependencies to the Module directory +Write-Host "Copying dependencies to Module directory..." +Copy-Item -Path "$releaseBinDir\Newtonsoft.Json.dll" -Destination "$rootPath\Module\bin" -Force + # Create a ZIP file of the release $zipPath = "$releaseBaseDir\PSProxmox-$version.zip" Compress-Archive -Path "$releaseVersionDir\*" -DestinationPath $zipPath -Force