ASP.NET Core 배포 오류 - Ensure that restore has run and that you have included '...' in the TargetFrameworks for your project.
.NET Framework 기반의 ASP.NET Core 프로젝트를 Platform target을 x64로 맞춰놓고 배포하는 경우 다음과 같은 오류가 발생할 수 있습니다.
Error Assets file 'F:\WebApplication1\WebApplication2\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.1/win7-x86'. Ensure that restore has run and that you have included 'net461' in the TargetFrameworks for your project. You may also need to include 'win7-x86' in your project's RuntimeIdentifiers. WebApplication2 C:\Program Files (x86)\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets 165
또는 x86인 Platform target을 x64로 교체할 때 다음과 같은 오류가 발생할 수 있습니다.
Could not resolve mscorlib for target framework '.NETFramework,Version=v4.6.1'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.
A diagnostic log has been written to the following location: "%LOCALAPPDATA%\Temp\VsProjectFault_6a426165-170b-469e-a2b1-3b690f7c907d.failure.txt".
이를 해결하려면, Visual Studio의 "Configuration Manager" 설정까지도 "AnyCPU"가 아닌 "x64"로 맞춰야 합니다.
만약 이렇게 맞춰도 오류가 계속된다면 Publish 설정(Settings) 메뉴를 선택해,
"Configuration"이 AnyCPU가 아닌 x64로 되어 있는지 확인해야 합니다.
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]