-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildAndDeploy.ps1
More file actions
33 lines (27 loc) · 1.25 KB
/
Copy pathBuildAndDeploy.ps1
File metadata and controls
33 lines (27 loc) · 1.25 KB
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
# Define paths
$solutionPath = $PSScriptRoot # Assuming the script is in the root folder of the solution
$buildOutputPath = Join-Path -Path $solutionPath -ChildPath "bin\Release\net8.0" # Adjust target framework if needed
$runFolderPath = Join-Path -Path $solutionPath -ChildPath "run"
# Build the project
Write-Output "Building the AI application..."
dotnet build $solutionPath -c Release
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed. Please check the build output for errors."
exit 1
}
# Ensure the run folder exists
if (-Not (Test-Path $runFolderPath)) {
New-Item -ItemType Directory -Path $runFolderPath
}
# Copy the built files to the run folder
Write-Output "Copying files to the run folder..."
Copy-Item -Path "$buildOutputPath\*" -Destination $runFolderPath -Recurse -Force
# Optionally, copy any additional required files
$additionalFiles = @("config.json", ".env")
foreach ($file in $additionalFiles) {
$sourceFilePath = Join-Path -Path $solutionPath -ChildPath $file
if (Test-Path $sourceFilePath) {
Copy-Item -Path $sourceFilePath -Destination $runFolderPath -Force
}
}
Write-Output "Build and copy process completed successfully. The application is ready to run in the 'run' folder."