msbuild - Your project file doesn't list 'win' as a "RuntimeIdentifier"
빌드 시 이런 오류가 발생한다면?
C:\temp\ConsoleApp1\ConsoleApp1\bin> msbuild "C:\temp\ConsoleApp1\ConsoleApp1.csproj"
MSBuild version 17.5.1+f6fdcf537 for .NET Framework
Build started 2024-12-10 오후 8:26:31.
Included response file: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.rsp
Project "C:\temp\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj" on node 1 (default targets).
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\NuGet\17.0\Microsoft.NuGet.targets(198,5): error : Your project file doesn't list 'win' as a "RuntimeIdentifier". You should add 'win' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore. [C:\temp\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj]
Done Building Project "C:\temp\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\temp\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj" (default target) (1) ->
(ResolveNuGetPackageAssets target) ->
C:\...[생략]...\Microsoft.NuGet.targets(198,5): error : Your project file doesn't list 'win' as a "RuntimeIdentifier". You should add 'win' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore. [C:\temp\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj]
0 Warning(s)
1 Error(s)
error : Your project file doesn't list 'win' as a "RuntimeIdentifier". You should add 'win' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore.
(
다행히 이번에는) 친절한 메시지가 일러주는 대로 ^^ 진행하면 됩니다. 우선, 1) csproj 파일을 열어 RuntimeIdentifiers 노드에 "win" 항목을 추가하고,
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<RuntimeIdentifiers>win</RuntimeIdentifiers>
<!-- ...[생략]... -->
</PropertyGroup>
</Project>
2) 해당 프로젝트에 대해 "nuget restore" 명령을 실행해 줍니다.
C:\temp\ConsoleApp1\ConsoleApp1> nuget restore "ConsoleApp1.csproj"
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]