Amazon EC2 인스턴스에 웹 API 서비스를 배포해야합니다. GitHub 저장소에서 소스를 다운로드하여 대상 EC2에 배치하도록 AWS CodeDeploy를 구성했습니다. 또한 Windows Server 2012와 함께 서버에 CodeDeploy Agent를 설치했습니다. 또한 소스가 성공적으로 다운로드 된 후 PowerShell 콘솔 (BuildApp.ps1 실행)에서 수동으로 수행하는 경우 프로젝트를 만들고 게시 할 수 있습니다.AWS CodeDeploy Agent를 통해 PowerShell에서 msbuild 실행
내가해야 할 일은 CodeDeploy 에이전트 작업 중에 자동으로 실행되는 PowerShell 스크립트를 통해 프로젝트를 작성하고 게시하는 것입니다.
나는 다음과 같은 내용을 가지고 appspec.yml 파일을 구성한:
version: 0.0
os: windows
files:
- source: /My-Project/
destination: C:\inetpub\my-project-dev\src
hooks:
AfterInstall:
- location: .\BuildApp.ps1
BuildApp.ps1 다음과 같은 내용이있다 : 나는 수행하는 경우
#Restore Nuget packages nuget install C:\inetpub\my-project-dev\src\RestApi\packages.config -OutputDirectory .\packages
Set-Location C:\inetpub\my-project-dev\src\RestApi
#Build the project msbuild RestApi.csproj /p:Configuration=Release /p:OutputPath="publish"
그러나, 아마존을 사용하여 게시를 CodeDeploy는 로그 파일을 통해 아래와 같은 오류를 표시합니다.
nuget : The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\ProgramData\Amazon\CodeDeploy\ca6544b1-d2cb-4a81-86c0-68ae0f60764b\d-A2V2JCQ3G\deployment-archive\BuildApp.ps1:3 char:1
nuget install C:\inetpub\my-project-dev\src\RestApi\packages.config
msbuild : The term 'msbuild' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\ProgramData\Amazon\CodeDeploy\ca6544b1-d2cb-4a81-86c0-68ae0f60764b\d-A2V2JCQ3G\deployment-archive\BuildApp.ps1:8 char:1
msbuild RestApi.csproj /p:Configuration=Release /p:OutputPath="publish"
원인 s PowerShell은 nuget 및 msbuild 명령을 찾지 못하나요?
CodeDeploy 외부에서 수동으로 실행할 때 스크립트가 제대로 작동합니까? –