Home > front end >  PostSharp compilation issue. Visual Studio 2022
PostSharp compilation issue. Visual Studio 2022

Time:11-01

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.

CodePudding user response:

Is this what you're looking for:

The following software components need to be installed before PostSharp can be used:

Any of the following versions of Microsoft Visual Studio:

Visual Studio 2017 (15.9).

Visual Studio 2019 (16.7).

Visual Studio 2022 (17.0).

The debugging experience may be inconsistent with other IDEs than Visual Studio or when PostSharp Tools for Visual Studio are not installed.

.NET Framework 4.7.2 or later.

Any of the following operating systems:

Windows 10: any version in mainstream Microsoft support, except LTSB and S editions.

On build agents only: Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Ubuntu 16.04, Ubuntu 18.04, Alpine 3.10, macOS 10.14.

Optionally, one of the following versions of .NET Core SDK:

.NET Core SDK 3.1 (build 3.1.100 or later).

.NET SDK 5.0 (build 5.0.100 or later).

.NET SDK 6.0 (build 6.0.100 or later).

CodePudding user response:

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.
  • Related