From 4e0eace63fda9203773301d321b966ba17872a63 Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini Date: Fri, 2 Aug 2019 13:34:27 +0100 Subject: [PATCH 1/5] Do not rely on versioned paths when importing deps This will remove the need to keep in sync the version in the psm1 with the version in the .csproj. Unfortunately, this is the best way I know of fixing issue #8. There seems to be no automated way of downloading dependencies when running Install-Module, so it's best to put DLLs inside the package itself. Fixes #8 --- FeatureFlags.psm1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/FeatureFlags.psm1 b/FeatureFlags.psm1 index 69e936d..d2db9e6 100644 --- a/FeatureFlags.psm1 +++ b/FeatureFlags.psm1 @@ -18,13 +18,14 @@ function Get-FeatureFlagConfigFromFile([string]$jsonConfigPath) { } # Import the JSON and JSON schema libraries, and load the JSON schema. -# TODO: don't rely on versioned paths. Use dotnet build / pack properly. -$schemaLibPath = Join-Path -Path $PSScriptRoot -ChildPath "External/njsonschema/9.13.19/lib/netstandard1.0/NJsonSchema.dll" +$libs = Get-ChildItem -Recurse -Path "$PSScriptRoot/External" +$libs = $libs | Where-Object {$_.Extension -ieq ".dll" -and $_.FullName -ilike "*netstandard1.0*"} | ForEach-Object {$_.FullName} +$schemaLibPath = $libs | Where-Object {$_ -ilike "*NJsonSchema.dll"} if (-not (Test-Path -Path $schemaLibPath -PathType Leaf)) { Write-Error "Could not find the DLL for NJSonSchema: $schemaLibPath" } -$jsonLibPath = Join-Path -Path $PSScriptRoot -ChildPath "External/newtonsoft.json/9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll" +$jsonLibPath = $libs | Where-Object {$_ -ilike "*Newtonsoft.Json.dll"} if (-not (Test-Path -Path $jsonLibPath -PathType Leaf)) { Write-Error "Could not find the DLL for Newtonsoft.Json: $jsonLibPath" } From eac762225eff48d37791da21478317f7b295187f Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini Date: Fri, 2 Aug 2019 13:35:04 +0100 Subject: [PATCH 2/5] Remove todo about .NET standard 2.0 NJSonSchema depends on Newtonsoft.json 9, which does not support .NET standard 1.0 --- PowerShell-FeatureFlags.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/PowerShell-FeatureFlags.csproj b/PowerShell-FeatureFlags.csproj index 38d6a3e..35a59ea 100644 --- a/PowerShell-FeatureFlags.csproj +++ b/PowerShell-FeatureFlags.csproj @@ -1,7 +1,6 @@ - netstandard1.0 PowerShell_FeatureFlags