msbuild로 .pubxml 설정에 따른 배포 파일을 만드는 방법
우선, 결론부터 말하면 pubxml 파일을 기반으로 한 msbuild 방법은 찾지 못했습니다. 검색해 보면 pubxml 파일의 이름을 주는 방법이 나오는데,
dotnet publish /p:PublishProfile=FolderProfile
실제로 해보면 다음과 같은 식의 오류가 발생합니다.
c:\program files\dotnet\sdk\2.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(122,5): error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true.
물론 오류 메시지에 따라 설정을 추가해도,
msbuild /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /p:UseAppHost=true
계속해서 오류가 꼬리를 물게 됩니다.
그나마 제가 찾은 방법은, 아예 그냥 pubxml에 설정했던 것과는 중복이 되지만 그냥 빌드 스크립트에서 또다시 명시를 하는 것입니다. 가령 다음의 코드는 ASP.NET Core 웹 응용 프로그램을 win-x64와 linux-x64 플랫폼 대상으로 릴리스 모드로 빌드해 배포 파일을 구성합니다.
dotnet publish /p:Configuration=Release -r win-x64
dotnet publish /p:Configuration=Release -r linux-x64
(혹시 pubxml을 연동할 수 있는 방법을 아시는 분은 덧글 부탁드립니다. ^^)
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]