.net nuget和直接引用dll的工作方式不同

.net nuget和直接引用dll的工作方式不同,.net,.net-core,nuget,msal,nuget-spec,.net,.net Core,Nuget,Msal,Nuget Spec,我对.Net世界一无所知,仍在努力掌握它的窍门。我有一个.NETCore2.1项目,我正在尝试直接在项目中引用和库。我从nuget下载了nupkg文件并解压缩了包。我将lib\netcoreapp2.1中的库复制到我的项目目录中。我在csproj中添加了以下内容 <ItemGroup> <Reference Include="Microsoft.Identity.Client"> <HintPath>Microsof

我对.Net世界一无所知,仍在努力掌握它的窍门。我有一个.NETCore2.1项目,我正在尝试直接在项目中引用和库。我从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.dll
Microsoft.Identity.Client.Extensions.Msal.dll
但是,Microsoft.Identity.Client.Extensions列出了一个未实现的依赖项,我没有添加该依赖项。应用程序仍在编译,但行为不符合预期。我查看了.nuspec文件,注意到nuget提到了如下所示的依赖项,当项目依靠nuget引用库时,它工作得非常好。当我下载并手动引用DLL时,情况并非如此。是否有任何方法可以将依赖项添加到my.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机制正在某个地方获取这两个依赖项

您手动添加引用而不是仅仅引用包并让nuget处理引用和依赖项有什么具体原因吗?似乎有很多繁琐且容易出错的工作。我有一个可以使用dll引用的现有基础设施。因此,我别无选择,只能加载并使用DLL。我意识到一旦我进入它,它很容易出错。