无法从 master 或通过 setup.py 在 Visual Studio 中构建 Python.NET Python.Runtime

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

我尝试从 Visual Studio 2019 年开始“构建解决方案”,因为 Python.NET 项目带有一个 .sln VS 解决方案文件

但是,它跳过了我感兴趣的 Python.Runtime 构建:

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

此外,其他4个构建有错误:

3>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\NuGet.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.

或者,当 运行 python setup.py 遵循 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

上的说明时

环境

我刚刚加载了 pythonnet.15.sln 而不是 pythonnet.sln 并且能够构建 DLL 文件。

虽然我仍然不确定为什么 pythonnet.sln 对我不起作用,但“15”是指 VS 版本吗?这张截图中使用的是普通的 sln,来自一次演讲 https://youtu.be/P7Or7XzeIno?t=1163