$env:MSBUILDDISABLENODEREUSE=1 는 donet 빌드시 여러 프로젝트가 동시에 빌드되면 MSB4166 가 발생하므로 피하기 위해 설정한 환경변수이다.

 

msbuild 의 경우 cmd 명령에 /nodeReuse:false 옵션을 준다.

 

 

write-host $pwd

############################################################
## Build
$env:MSBUILDDISABLENODEREUSE=1
nuget restore ./TestServer/TestServer/TestServer.sln
dotnet restore ./TestServer/TestServer/TestServer.sln
dotnet build ./TestServer/TestServer/TestServer.sln -c Debug

  

############################################################
## Deploy

$ip = "127.0.0.1"
$user = $env:REMOTE_WIN_ID
$pass = $env:REMOTE_WIN_PW

$src = "$(Get-Location)\TestServer\TestServer\bin\Debug\netcoreapp3.1\*"
$dst = "D:\Deploy\Bin\TestServer"

# START SESSION
$securePass = ConvertTo-SecureString -AsPlainText -Force $pass
$credential = New-Object System.Management.Automation.PSCredential($user, $securePass)
$session = New-PSSession -ComputerName $ip -Credential $credential

# STOP SERVICE
Invoke-Command -Session $session {Stop-Service -Name TestServer}

# COPY BINARY
Copy-Item "$src" -Destination "$dst" -ToSession $session -Recurse -Force

# START SERVICE
Invoke-Command -Session $session {Start-Service -Name TestServer}

# END SESSION
Remove-PSSession $session

 

 

'C#' 카테고리의 다른 글

c# channel  (0) 2022.03.15
object pool, object type pool  (0) 2022.03.11
GC TEST  (0) 2022.03.08
GC EventPipe 모니터링  (0) 2022.03.08
c# stack size 확인  (0) 2022.02.24
숫자 범위 추출 및 확장  (0) 2021.11.03
C# LZ4  (0) 2021.10.20
dictionary 에 action 매핑시 instance method 호출 방법  (0) 2021.10.16