<# .SYNOPSIS Removes all non-core files from build output #> param( [Parameter(ValueFromPipeline = $true, Position = 0, Mandatory = $true)] $targetDir ) $nativeSqliteDllLocation = "$( $targetDir )runtimes\win-x64\native\e_sqlite3.dll"; if ($false -eq (Test-Path $nativeSqliteDllLocation)) { Write-Error "POST BUILD FAILED: Unable to locate $nativeSqliteDllLocation" } Write-Host "Copying '$nativeSqliteDllLocation' to '$targetDir'" Copy-Item -Path $nativeSqliteDllLocation -Destination $targetDir # Because we use CopyLocalLockFileAssemblies Files that are needed for the module $allowList = @( "ModuleCore*" "PowershellModule*" "*SQLite*" "data" ) Write-Host "Removing all non-module required files from '$targetDir'" Get-ChildItem -Path $targetDir -exclude $allowList | Remove-Item -Recurse