To reproduce this problem, only have RestPS version 7.0.4 installed (have not tested with other versions). When Invoke-DeployRestPS is run, the following error is generated along with lots of the same types of errors.
Copy-Item : Cannot find path 'C:\C\endpoints\Invoke-AvailableRouteSet.ps1' because it does not exist.
At C:\Program Files\WindowsPowerShell\Modules\RestPS\7.0.4\RestPS.psm1:368 char:9
+ Copy-Item -Path "$RoutesFileSource" -Destination $LocalDir\En ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\C\endpoints\...bleRouteSet.ps1:String) [Copy-Item], ItemNotFoundExce
ption
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
This is due to line 38 of Invoke-DeployRestPS.ps1 expecting a collection of items:
When only a single path is returned, the previous code causes only the first character in the path to be added to the $Source variable. When more than one version of the RestPS module is installed, it returns a collection and the first path is stored in the $Source variable.
Consider using different logic like the following instead of an element in a collection to select a single path.
Also consider adding a parameter to Invoke-DeployRestPS in case the user needs to deploy with a specific version of the RestPS module (if there's any difference).
To reproduce this problem, only have RestPS version 7.0.4 installed (have not tested with other versions). When
Invoke-DeployRestPS
is run, the following error is generated along with lots of the same types of errors.This is due to line 38 of Invoke-DeployRestPS.ps1 expecting a collection of items:
When only a single path is returned, the previous code causes only the first character in the path to be added to the
$Source
variable. When more than one version of the RestPS module is installed, it returns a collection and the first path is stored in the$Source
variable.Consider using different logic like the following instead of an element in a collection to select a single path.
I'll submit a PR to fix this particular problem.
Also consider adding a parameter to
Invoke-DeployRestPS
in case the user needs to deploy with a specific version of the RestPS module (if there's any difference).