我正在4.7.2 .net Framework项目中使用此nuget软件包-JSNlog,其中列出了以下依赖项:
.NETFramework 4.5.2
Common.Logging (>= 3.3.1)
Microsoft.AspNetCore.Http (>= 1.1.2)
Microsoft.AspNetCore.Mvc (>= 1.1.3)
Microsoft.AspNetCore.Mvc.TagHelpers (>= 1.1.3)
Microsoft.Extensions.Logging (>= 1.1.2)
Microsoft.Owin (>= 2.1.0)
Newtonsoft.Json (>= 9.0.1)
.NETStandard 2.0
Microsoft.AspNetCore.Http (>= 1.1.2)
Microsoft.AspNetCore.Mvc (>= 1.1.3)
Microsoft.AspNetCore.Mvc.TagHelpers (>= 1.1.3)
Microsoft.Extensions.Logging (>= 1.1.2)
在安装此软件包时,我得到了以下缺少的参考,它们看起来像是.net核心参考:
它将在package文件夹中查找引用,例如:
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
但要正常工作,它应该类似于(从包中手动添加对dll的引用时插入的内容,并且确实以这种方式指向外观):
<Reference Include="Microsoft.Win32.Primitives" />
这是此dll的nuget日志:
For adding package 'Microsoft.Win32.Primitives.4.3.0' to project 'WebApplication5' that targets 'net472'.
For adding package 'Microsoft.Win32.Primitives.4.3.0' to project 'WebApplication5' that targets 'net472'.
Adding package 'Microsoft.Win32.Primitives.4.3.0' to folder 'C:\Users\xxx\Documents\Visual Studio 2017\Projects\WebApplication5\packages'
Added package 'Microsoft.Win32.Primitives.4.3.0' to folder 'C:\Users\xxx\Documents\Visual Studio 2017\Projects\WebApplication5\packages'
Added package 'Microsoft.Win32.Primitives.4.3.0' to folder 'C:\Users\xxx\Documents\Visual Studio 2017\Projects\WebApplication5\packages' from source 'https://api.nuget.org/v3/index.json'
Added reference 'Microsoft.Win32.Primitives' to project:'WebApplication5'. The Reference was Resolved To Package (resolvedToPackage):'False', where Reference Path from DTE(dteOriginalPath):'' and Reference Path from package reference(assemblyFullPath):'C:\Users\xxx\Documents\Visual Studio 2017\Projects\WebApplication5\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll'.
Added package 'Microsoft.Win32.Primitives.4.3.0' to 'packages.config'
这仅在.net Framework 4.7.1 / 4.7.2项目中发生,这些引用在4.6.1项目中不丢失。
Facade dll似乎都正确安装了
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\Facades
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades
并且已安装.NET Core SDK 2.1.302(也已安装旧版本)
我使用Visual Studio 15.7.6和NuGet 4.6.0
我打开了an issue to JSNLog,但是维护者也不确定采取最佳措施来防止那些丢失的引用。包装目标4.7.x也应该吗?它应该针对.net标准2.0吗?有没有其他方法可以防止那些丢失的引用,或者甚至更好的是,防止它们丢失,因为它们已经是框架的一部分了?是否应该卸载旧版本的.net core?