Skip to content

Commit

Permalink
launchsettings for debugging in visual studio (#1880)
Browse files Browse the repository at this point in the history
  • Loading branch information
4ndri authored May 22, 2022
1 parent f635449 commit b61eacb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Commands/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"profiles": {
"PnP.PowerShell-Module": {
"commandName": "Executable",
"executablePath": "pwsh",
"commandLineArgs": "-NoExit -NoProfile -Command Import-Module $(ProjectDir)/_debug/debug.ps1",
"workingDirectory": "$(ProjectDir)\\..\\..\\"
}
}
}
24 changes: 24 additions & 0 deletions src/Commands/_debug/debug.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$ProjectPath = $PSScriptRoot | Split-Path -Parent
$BinPath = "$ProjectPath\bin\Debug"

$dlls = @("PnP.PowerShell.ALC.dll", "PnP.PowerShell.dll")

$netversion = "netcoreapp3.1"

if ($PSEdition -eq 'Core') {
$netversion = "netcoreapp3.1"
}
else {
$netversion = "net461"
}

$BinPath = "$BinPath\$netversion"

foreach ($dll in $dlls) {
try {
Import-Module "$BinPath\$dll" -Force -Global
}
catch {
Write-Warning -Message "load.ps1: Import Modules -- $($_.Exception.Message)"
}
}

0 comments on commit b61eacb

Please sign in to comment.