-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCollectOutput.ps1
49 lines (40 loc) · 1.83 KB
/
CollectOutput.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Get the current script's directory (assumes the script is in the root of the solution)
$scriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
# Define the source and destination directories relative to the script's location
$solutionDirectory = "$scriptDirectory" # Assuming the script is in the solution root
$outputDirectory = "$scriptDirectory\OutputDlls" # Target directory relative to the solution
# Clean the output directory
if (Test-Path $outputDirectory) {
Remove-Item -Recurse -Force $outputDirectory
}
New-Item -ItemType Directory -Path $outputDirectory
# Define the build configuration
$buildConfiguration = "Debug" # or "Release"
# Search for project bin folders and copy DLLs
$projectDirectories = Get-ChildItem -Path $solutionDirectory -Recurse -Directory | Where-Object {
Test-Path "$($_.FullName)\bin\$buildConfiguration\net8.0"
}
foreach ($projectDir in $projectDirectories) {
$sourceDir = "$($projectDir.FullName)\bin\$buildConfiguration\net8.0"
Write-Host "Checking: $sourceDir"
if (Test-Path $sourceDir) {
$dllFiles = Get-ChildItem -Path $sourceDir -Filter "*.dll"
foreach ($dll in $dllFiles) {
Copy-Item -Path $dll.FullName -Destination $outputDirectory
}
} else {
Write-Host "Directory does not exist: $sourceDir"
}
}
# Remove unwanted DLLs from the output directory
$excludedFiles = @("YawGLAPI.dll") # Add other files to exclude as needed
foreach ($excludedFile in $excludedFiles) {
$filePath = Join-Path -Path $outputDirectory -ChildPath $excludedFile
if (Test-Path $filePath) {
Remove-Item -Path $filePath -Force
Write-Host "Deleted: $excludedFile from $outputDirectory"
} else {
Write-Host "File not found for deletion: $excludedFile"
}
}
Write-Host "All DLLs have been copied to $outputDirectory"