Cannot build Python.NET Python.Runtime in Visual Studio from master, or via setup.py

720 views Asked by At

I tried to "Build Solution" from Visual Studio 2019, since the Python.NET project comes with a .sln VS Solution file enter image description here

However, it skipped the Python.Runtime build which is what I'm interested in:

1>------ Skipped Build: Project: Python.Runtime ------

Furthermore, the other 4 builds had an error:

3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(186,5): error : Your project file doesn't list 'win-x64' as a "RuntimeIdentifier". You should add 'win-x64' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore.

Alternatively, when running python setup.py following instructions on https://github.com/pythonnet/pythonnet/wiki/Installation#github-installation-from-master-branch, I ran into another error from not being able to find Windows Kits installed roots. Have been looking around for answers and tried different versions of Python, .NET Core, .NET etc. to no avail. I detailed it in https://github.com/pythonnet/pythonnet/issues/1272

Environment

  • Pythonnet version: 3.0 (ongoing, latest master branch ending at c81c3c3)
  • Python version: 3.7.9
  • Operating System: Windows 10, 64bit, WinPE
1

There are 1 answers

0
Christabella Irwanto On BEST ANSWER

I just loaded pythonnet.15.sln instead of pythonnet.sln and was able to build the DLL file.

Although I'm still not sure why pythonnet.sln didn't work for me, does "15" refer to the VS version? The regular sln was being used in this screenshot from a talk https://youtu.be/P7Or7XzeIno?t=1163