Xamarin UWP 项目不安装来自 Nuget 的依赖项

Xamarin UWP project doesn't install dependencies from Nuget

我有一个案例,当我在我的 xamarin 表单项目上安装任何 nuget 包时,只有 UWP 项目没有正确安装。它只安装主包,但不安装依赖项。 Android 和 IOS 项目似乎没有发生这种情况,但只有 UWP。正如您在下面看到的。我安装了这个包并且有依赖项

但是当我检查列表中的依赖项之一时,它显示未安装。

但是输出 window 表明它已安装并写入 project.lock.json 文件,我可以在那里找到它。

但我正在使用 project.json 文件,如下所示。

当我检查 project.json 文件时,它只有 Microsoft.NETCore.UniversalWindowsPlatform 主包的引用。没有依赖项的参考。

所以我的问题是; project.json 和 project.lock.json 有什么区别?我需要他们两个吗?该项目是 2 年前使用 Vs2015 创建的,并且一直在升级。如果我使用 Vs2017 15.5.3 版本创建一个新项目,我在 UWP 项目下看不到这些文件? 这里有什么问题?有人可以阐明这个问题吗?

编辑: 基于下面的答案,如果我安装主包,我应该假设安装了依赖项,但是例如,我安装了这个 Akavache nuget,如下所示

它会弹出它将安装 akavache.core 之类的依赖项,但是在 nuget-solution 上完成了一个安装,我看到下面的屏幕。如何确保它已经安装?

另一件事是我在我的 uwp 项目附近看到 csproj 扩展。我不确定这是否与将表单 Project.json 文件更改为 csproj 作为 nuget 导入位置有关。

what are the difference between project.json and project.lock.json? Do I need both of them? this project is created 2 years ago using Vs2015 and always upgraded. If I create a new project using Vs2017 15.5.3 version, i dont see neither of these files under UWP project?

根据 project.json reference 文档,project.json 文件维护项目中使用的包列表,称为包引用格式。它取代了 packages.config,但又被 PackageReference 与 NuGet 4.0+ 取代

project.lock.json文件是在使用project.json的项目中还原NuGet包的过程中生成的。

But when I check one of the dependency in the list, it shows that not installed.

实际上,Microsoft.NETCore.UniversalWindowsPlatform 版本 6.0.6 包含 .NET native compilers。您无需单独安装 Microsoft.Net.Native.Compiler

最新的 Microsoft.Net.Native.Compiler 仅在 Windows 10 Fall Creators Update (10.0;build 16299) 中可用。如果已单独安装,则需要将目标最低版本修改为16299。

更新

It popups that it will install dependencies like akavache.core for example but one installation is finished on nuget-solution, i am seeing the screen below. How can I ensure that it is already installed?

Microsoft.Net.Native.Compiler不会显示在项目的References文件夹中,需要用包管理器工具管理

您可以在以下文件夹中找到 project.assets.json。它记录了你安装的nuget包。

Path: C:\Users\xxxx\source\repos\GetPlainTextTest\GetPlainTextTest\obj\project.assets.json