2
votes

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.

I tracked requests which VS2015 made to download package and query string which VS2015 sends to NuGet source is:

?$filter=IsAbsoluteLatestVersion&searchTerm='Package-ID'&targetFramework='net'&includePrerelease=true&$skip=0&$top=126

Problem is with parameter targetFramework. When VS2015 uses targetFramework='net' than it cannot read packages for framework net461, they are skipped.

When I executed request in Postman and set targetFramework='net461' then I am able to find package.

Also I noticed that VS2015 sporadically changing target framework from net to net461.

My question is: Do I need to configure my VS2015 or I have to change my NuGet package?

NuGet package is created form .NET Core 2.0 project and here is configuration:

<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. It is latest what is offered on Visual Studio 2015 for me.

1
What version of nuget package manager you are using?Pankaj Kapare
@PankajKapare Version of NuGet package manager is: 3.5.0.1484.kat1330
I am not very clear your question. To confirm, do you mean that you could find the nuget package on your private NuGet server from Visual Studio 2015? Are you using NuGet Package Mamager UI to find this package? Besides, how VS2015 uses targetFramework='net'? Could you please provide some steps to us so that we could understand this question clear, some screenshot would be better.Leo Liu-MSFT
I am able to find packages form nuget.org and "certain packages" from private source. "Certain Packages" means some are visible and some not (I don't know why, trying to understand that). I am using both Package Manager Console and GUI. I don't have certain steps because only I added sources URLs to NuGet Package Manager. Let me know which information I can provide to you because I don't have any extra config. This is very confusing to me.kat1330
Are packages that cannot be found pre-released? Have you checked the checkbox Include prerelease on the nuget package manager UI? If checked, but you still could not find it, could you please share one of those sample package to me by onedrive, so that I can check it, if you do not mind.Leo Liu-MSFT

1 Answers

0
votes

I am able to find packages form nuget.org and "certain packages" from private source. "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.

According to the sample config for package, I noticed that the value of GeneratePackageOnBuild is set to False rather than True:

  <PropertyGroup>
    ...
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    ...
  </PropertyGroup>

When the value is set to false, Visual Studio will not generate package. 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.