.net - nuget 和直接引用 dll 的工作方式不同
问题描述
我是.Net 世界的新手,但仍在努力掌握它。我有一个 .Net core 2.1 项目,我试图直接在项目中引用Microsoft.Identity.Client.Extensions和Microsoft.Identity.Client库。我从 nuget 下载了 nupkg 文件并提取了包。我将lib\netcoreapp2.1中的库复制到我的项目目录中。我在 csproj 中添加了以下内容。
<ItemGroup>
<Reference Include="Microsoft.Identity.Client">
<HintPath>Microsoft.Identity.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Identity.Client.Extensions.Msal">
<HintPath>Microsoft.Identity.Client.Extensions.Msal.dll</HintPath>
</Reference>
</ItemGroup>
但是,我没有添加 Microsoft.Identity.Client.Extensions 列出的未实现的依赖项。应用程序仍可编译,但未按预期运行。我查看了 .nuspec 文件,我注意到 nuget 提到了如下所示的依赖项,当项目重新使用 nuget 来引用库时,它运行良好。当我下载并手动引用 dll 时,情况并非如此。有什么方法可以将依赖项添加到我的 .csproj 文件中的现有 dll 中。问题是没有失败,应用程序没有按预期运行。
<dependencies>
<group targetFramework=".NETCoreApp2.1">
<dependency id="Microsoft.Identity.Client" version="4.15.0" exclude="Build,Analyzers" />
<dependency id="System.Security.Cryptography.ProtectedData" version="4.5.0" exclude="Build,Analyzers" />
</group>
</dependencies>
我确信nuget机制正在某处获取两个依赖项
解决方案
推荐阅读
- c# - WebUtility.HtmlEncode 和 AntiXssEncoder.HtmlEncode 有什么区别?
- optaplanner - OptaPlanner 日志求解器相变
- javascript - 如何通过ajax处理更改数据库中的布尔字段?
- database - PostgreSQL - MVCC(多版本并发控制) - 何时获取实际锁?
- node.js - 使用 multer 将文件上传到 S3 存储桶期间的 CRC32 检查
- testing - 当所有测试都完成运行时,我如何调用一个函数?
- apache-spark - GeoMesa Spark 无法使用 UDF 函数
- r - 具有相同颜色(特征)的 R igraph 集群节点
- python-3.x - 如何创建上下文菜单以删除 qtableview python 内部的行
- php - 导航到 Wordpress 中的新页面时无法清除 WooComerce 购物车