I want to Use Windows.Gaming.Input
(GameInput) in Windows Form project.
I found this link, But I could not add Windows.Gaming
.
I have created a project in Microsoft Visual Studio 2022 (.Net 5.0), Then i after created and changed it to .Net Framework 4.8
file .csproj
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<TargetPlatformVersion>10.0</TargetPlatformVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<UseWpf>False</UseWpf>
<UseWindowsForms>True</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<StartupObject>Service.App</StartupObject>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>False</Prefer32Bit>
<Title>IO Service</Title>
<Description>Assembly providing.</Description>
<RootNamespace>Service</RootNamespace>
<AssemblyTitle>Service</AssemblyTitle>
<AssemblyName>Service</AssemblyName>
<LangVersion>10.0</LangVersion>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<UserSecretsId>e6074671-c86e-45e7-9fe9-7081c2cae035</UserSecretsId>
<Optimize>False</Optimize>
<FileAlignment>512</FileAlignment>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Resources\Icon\App.ico</ApplicationIcon>
<UseApplicationTrust>False</UseApplicationTrust>
<!-- for .Net -->
<ApplicationVisualStyles>True</ApplicationVisualStyles>
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>False</ApplicationUseCompatibleTextRendering>
<ApplicationDefaultFont>Microsoft Sans Serif, 8.25pt</ApplicationDefaultFont>
<AutoGenerateBindingRedirects>False</AutoGenerateBindingRedirects>
<UseVSHostingProcess>False</UseVSHostingProcess>
<ErrorReport>none</ErrorReport>
<WarningLevel>4</WarningLevel>
<Deterministic>True</Deterministic>
<DebugType>portable</DebugType>
<NeutralLanguage>en-US</NeutralLanguage>
<IsWebBootstrapper>False</IsWebBootstrapper>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Using Include="Windows.Gaming" />
</ItemGroup>
</Project>
I installed System.Runtime.WindowsRuntime, but Universal Windows was not added in the reference. image1 image2
after add <TargetPlatformVersion>10.0</TargetPlatformVersion>
Global Usings show in project Properties, I added Windows.Gaming
in Global Usings but it doesn't work.
Does anyone know what I should do?