NETSDK1082
指定された RuntimeIdentifier 'win10-arm' で利用できる Microsoft.WindowsDesktop.App.WindowsForms のランタイム パックがありませんでした。
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets
ビルド時に「指定された RuntimeIdentifier 'win10-arm' で利用できる Microsoft.WindowsDesktop.App.WindowsForms のランタイム パックがありませんでした。」のエラーが出る場合の対処法を紹介します。
ビルド時に以下のエラーが発生します。
または
英語では以下のメッセージになります。
または
プロジェクトファイルを編集し、RuntimeIdentifiers
タグを追加します。
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
または
<RuntimeIdentifiers>win10-x86;win10-x64</RuntimeIdentifiers>
を追加します。また、ターゲットプラットフォームから ARMを外します。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>arm;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>x86;x64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>x64</Platforms>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
</ItemGroup>
</Project>
変更後プロジェクトをビルドしエラーが解消されることを確認します。