Skip to content

Commit 137d4e7

Browse files
committed
fix: Could not get token: Unable to find type [CIPP.CIPPRestClient]. when running Initialize-DevEnvironment
1 parent 6fc4ca5 commit 137d4e7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Tools/Initialize-DevEnvironment.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Write-Host 'Initializing development environment...' -ForegroundColor Green
22
$CippRoot = (Get-Item $PSScriptRoot).Parent.FullName
3+
$env:CIPPRootPath = $CippRoot
34
### Read the local.settings.json file and convert to a PowerShell object.
45
$CIPPSettings = Get-Content (Join-Path $CippRoot 'local.settings.json') | ConvertFrom-Json | Select-Object -ExpandProperty Values
56
### Loop through the settings and set environment variables for each.
@@ -19,6 +20,11 @@ if ($IsWindows) {
1920
}
2021
}
2122

23+
$CIPPHttpDllPath = Join-Path $CippRoot 'Shared\CIPPHttp\bin\CIPPHttp.dll'
24+
if ((Test-Path $CIPPHttpDllPath) -and !('CIPP.CIPPRestClient' -as [type])) {
25+
[Reflection.Assembly]::LoadFile($CIPPHttpDllPath) | Out-Null
26+
}
27+
2228
# Remove previously loaded modules to force reloading if new code changes were made
2329
$LoadedModules = Get-Module | Select-Object -ExpandProperty Name
2430
switch ($LoadedModules) {

0 commit comments

Comments
 (0)