From f48ffbcc113cf72fd660c68846bd0a176bdbf470 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 May 2021 15:42:34 -0700 Subject: [PATCH] Updated dobuild.ps1 --- dobuild.ps1 | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/dobuild.ps1 b/dobuild.ps1 index 068dcf6..bef7e29 100644 --- a/dobuild.ps1 +++ b/dobuild.ps1 @@ -13,34 +13,38 @@ Implement build and packaging of the package and place the output $OutDirectory/ function DoBuild { Write-Verbose -Verbose -Message "Starting DoBuild" - + Write-Verbose -Verbose -Message "Copying module files to '${OutDirectory}/${ModuleName}'" # copy psm1 and psd1 files copy-item "${SrcPath}/*" "${OutDirectory}/${ModuleName}" -Recurse - # # copy help - Write-Verbose -Verbose -Message "Copying help files to '${OutDirectory}/${ModuleName}'" - copy-item -Recurse "${HelpPath}/${Culture}" "${OutDirectory}/${ModuleName}" + # Write-Verbose -Verbose -Message "Copying help files to '${OutDirectory}/${ModuleName}'" + # copy-item -Recurse "${HelpPath}/${Culture}" "${OutDirectory}/${ModuleName}" - if ( Test-Path "${SrcPath}/code" ) { + $subsystemCodePath = Resolve-Path "${SrcPath}\..\DscSubsystem" + $subsystemBinPath = "bin/Debug/net6.0/publish/Microsoft.PowerShell.DscSubsystem.dll" + Write-Verbose -Verbose -Message "Subsystem code path ${subsystemCodePath}" + + if ( Test-Path $subsystemCodePath ) + { Write-Verbose -Verbose -Message "Building assembly and copying to '${OutDirectory}/${ModuleName}'" - # build code and place it in the staging location - try { - Push-Location "${SrcPath}/code" - $result = dotnet publish - copy-item "bin/Debug/netstandard2.0/publish/${ModuleName}.dll" "${OutDirectory}/${ModuleName}" + + Push-Location $subsystemCodePath + $result = dotnet publish + if (Test-Path $subsystemBinPath) + { + Copy-Item $subsystemBinPath "${OutDirectory}/${ModuleName}" } - catch { - $result | ForEach-Object { Write-Warning $_ } - Write-Error "dotnet build failed" - } - finally { - Pop-Location + else + { + Write-Error "dotnet build failed - $subsystemBinPath not found - $result" } + + Pop-Location } else { - Write-Verbose -Verbose -Message "No code to build in '${SrcPath}/code'" + Write-Verbose -Verbose -Message "No code to build in '$subsystemCodePath'" } ## Add build and packaging here