Search code examples
debuggingcompilationvisual-studio-2022postsharp

PostSharp compilation issue. Visual Studio 2022


I have started getting following errors on projects containing PostSharp 6.6.6 nuget in Visual Studio 2022(64bit Version 17.3.6).

Warning PS0219 The targeting pack for platform ".NETFramework,Version=v4.6.2" is not installed. Please install the appropriate targeting pack. Project C:\Project\POSTSHARP

Warning PS0262 PostSharp encountered some recoverable errors while parsing the pdb file of Project.dll. The debugging experience may be affected. Project C:\Project\POSTSHARP

Those messages a bit disturbing, because projects are targeting .NET CORE 3.1 App(not UWP). Unfortunately "debugging experience" is affected. My break points in projects r not getting hit. What also unfortunate, that I could not remove Postsharp from the projects, which could be a solution but, alas, not in my case.

Cleaning, rebuilding, restarting did make any difference, obviously.

I could not find any reason why PostSharp are looking for .NET Framework on projects, which r not utilizing that framework.

Does anybody could shed some light why PostSharp behaves like that?

UPDATE

After Upgrading PostSharp nuget to version 6.10.15 message about "recoverable errors" went away, tests started to behave as they suppose to. But message about .Net Framework is still there. It does not look like it has any consequence, but I am curious why it PostSharp so hanged on 4.6.2 version.


Solution

  • You are using an old PostSharp version, support of which ended December 27, 2020 (it was not an LTS version), see this.

    This version is not compatible with Visual Studio 2022.

    There are two options:

    1. Upgrade to PostSharp 6.10.x.
    2. Use Visual Studio 2019. A reliable version would be 16.4 LTS release, which was released before PostSharp 6.6.6, but its support ended Oct 12, 2021. However, it's likely that the latest LTS version (16.11) of VS 2019 would work without problems.