CodexBloom - Programming Q&A Platform

Visual Studio 2022 - scenarios 'how to to find project for target framework' when restoring NuGet packages

👀 Views: 3 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-08
visual-studio nuget .net dotnet C#

I'm trying to debug I'm integrating two systems and After trying multiple solutions online, I still can't figure this out. I'm experiencing an scenario in Visual Studio 2022 where I'm unable to restore NuGet packages for my .NET 5 project. Whenever I try to restore, I get the behavior message 'Unable to find project for target framework '.NETFramework,Version=v4.7.2'. I've checked my project file and it appears to be correctly targeting .NET 5. The relevant part of my `.csproj` file looks like this: ```xml <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net5.0</TargetFramework> </PropertyGroup> </Project> ``` Additionally, I've tried clearing the NuGet cache using the command: ``` dotnet nuget locals all --clear ``` I've also verified that my Visual Studio is updated to the latest version (17.1). When I look at the 'Manage NuGet Packages' window, it shows the correct framework but still fails on the restore. I even tried creating a new project targeting .NET 5, and it restored packages without issues. What could be causing this question? Any insights would be greatly appreciated! This is for a microservice running on Windows 11. Cheers for any assistance! I'm working with C# in a Docker container on Debian. How would you solve this? I recently upgraded to C# 3.10. Am I approaching this the right way? I'm on Ubuntu 22.04 using the latest version of C#. Could someone point me to the right documentation?