[英]Visual Studio 2015 update 3 cannot read NuGet package
I am able to read packages from NuGet.org but I am not able to read only certain packages from our private NuGet server - Klondike . 我可以从NuGet.org中读取软件包,但不能仅从我们的私有NuGet服务器Klondike中读取某些软件包。
I tracked requests which VS2015 made to download package and query string which VS2015 sends to NuGet source is: 我跟踪了VS2015提出的下载VS2015发送到NuGet源的程序包和查询字符串的请求是:
?$filter=IsAbsoluteLatestVersion&searchTerm='Package-ID'&targetFramework='net'&includePrerelease=true&$skip=0&$top=126
Problem is with parameter targetFramework
. 问题在于参数
targetFramework
。 When VS2015 uses targetFramework='net'
than it cannot read packages for framework net461
, they are skipped. 当VS2015使用
targetFramework='net'
,它无法读取框架net461
软件包,因此将跳过它们。
When I executed request in Postman and set targetFramework='net461'
then I am able to find package. 当我在Postman中执行请求并设置
targetFramework='net461'
时,便可以找到程序包。
Also I noticed that VS2015 sporadically changing target framework from net
to net461
. 我还注意到VS2015偶尔将目标框架从
net
更改为net461
。
My question is: Do I need to configure my VS2015 or I have to change my NuGet package? 我的问题是: 我需要配置VS2015还是必须更改NuGet软件包?
NuGet package is created form .NET Core 2.0 project and here is configuration: NuGet包是从.NET Core 2.0项目创建的,配置如下:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<Company>Stackoverflow</Company>
<Authors>kat1330</Authors>
<Description>Package consists banch of functionalities.</Description>
<PackageTags>rules, rule engine</PackageTags>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>True</IncludeSource>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\cert.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>
</Project>
UPDATE: Version of NuGet package manager is: 3.5.0.1484 . 更新:NuGet软件包管理器的版本是: 3.5.0.1484 。 It is latest what is offered on Visual Studio 2015 for me.
这是Visual Studio 2015为我提供的最新内容。
I am able to find packages form nuget.org and "certain packages" from private source.
我可以从nuget.org中找到软件包,并可以从私人来源中找到“某些软件包”。 "Certain Packages" means some are visible and some not
“某些软件包”表示某些可见,而有些则不可见
Since you able to find packages form nuget.org and "certain packages" from private source ("Certain Packages" means some are visible and some not), so, the reason for the invisible package should be related to the package itself not about the nuget and private source. 由于您可以从nuget.org和“某些包”中找到私有包(“某些包”表示某些可见,而有些则不可见),因此,不可见包的原因应与包本身有关,而不是与nuget和私人资源。
According to the sample config for package, I noticed that the value of GeneratePackageOnBuild
is set to False rather than True : 根据包的示例配置,我注意到
GeneratePackageOnBuild
的值设置为False而不是True :
<PropertyGroup>
...
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
...
</PropertyGroup>
When the value is set to false , Visual Studio will not generate package. 当该值设置为false时 ,Visual Studio将不会生成包。 So, you should make sure if the package is generated.
因此,您应确保是否生成了软件包。 If it was generated, check if you can access it and download it.
如果已生成,请检查是否可以访问并下载。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.