Search code examples
c#visual-studio-2022notification-listener

How to setup Visual Studio 2022 .NET 7.0 to create a Notification Listener


How to setup Visual Studio 2022 .NET 7.0 to create a Notification Listener? I am using this documentation Notification Listener.

I tried the documentation but can't find the file

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\System.Runtime.dll

(Same file with .xml extension exists.)


Solution

  • I had this exact error and I fixed it by installing the Windows SDK and then using it to edit the .csproj of your project and changing the TargetFramework to this:

    <TargetFramework>net7.0-windows$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</TargetFramework>