Home > Blockchain >  Nuget won't install package, due to a mismatch in the targeted framework
Nuget won't install package, due to a mismatch in the targeted framework

Time:11-30

I have a C# project that references the python package. This project was developed in Visual Studio 2017, and targeted .NET 4.5.2. I am now updating the project, targeting .NET 4.7.2. I also want to update the python package to a later version (one which has Python 3.9 and not Python 3.5).

When I try to update the package. I get an error saying the package can't be installed in a project that targets .NET 4.7.2, because it doesn't reference any .NET 4.7.2 assemblies or content.

So it's quite obvious I can't use .NET 4.7.2 with this package. The question is - which version of .NET can I use with this package? How can I tell which .NET framework a Nuget package supports?

CodePudding user response:

If you start off going to the package page on nuget.org, as posted in the comments to your question: https://www.nuget.org/packages/python/3.9.9

On the right hand side, there's a link called "Open in NuGet Package Explorer" which will take you here: https://nuget.info/packages/python/3.9.9

This lets you inspect the contents of the package.

Now, you need some knowledge of how NuGet works, but of the 3 top level folders in the package, only build/ matches a NuGet convention. The only file under here is build/native/python.props, which matches NuGet's convention of build/{tfm}/{packageid}.[props|targets].

Therefore, this package is only compatible with the native TFM, which are C , not .NET, projects.

  • Related