3
votes

Details

  • Using Visual Studio 2017
  • Built NuGet package with NuGet Package Explorer
  • Placed .nupkg file in local folder on disk
  • Added folder to Package Sources in Visual Studio
  • I attempt to install the package using the Visual Studio GUI (Tools > NuGet Package Manager > Manage NuGet Packages for Solution...).

Problem

My package shows up in the list in the GUI, but when I click install, an error message says it can't find the package in the folder I put the .nupkg file in:

Package 'TDDeviceIntegration 1.0.0' is not found in the following primary source(s): 'C:\Users\j.smith\Documents\Visual Studio 2017\LocalNugetRepository\'. Please verify all your online package sources are available (OR) package id, version are specified correctly.   

What I've tried

  • Putting the NuGet Package I've built in several different local folder locations and adding those to the Package Sources, all with the same result (it can't find the package I JUST put there).
  • I've restarted Visual Studio several times.
  • I've restarted my computer.
  • I've cleared my NuGet cache(s) from Visual Studio

Question

How do I diagnose this? How do I fix this? I just want to make sure that the NuGet package works locally before I give it to the rest of the team.

Thanks in advance!

2
does it work if you rename it to TDDeviceIntegration.1.0.0.nupkg? (dot instead of space between package name and version).orhtej2
DING DING DING @orhtej2! Changing the space in the name of the .nupkg file is what allowed the installation to seem to be successful! Thank you so much!Jake Smith
Do you want to write an answer I can accept?Jake Smith
@orhtej2, Could you please convert your comment to the answer, this can be beneficial to other community members reading this thread and find the answer. Thanks.Leo Liu-MSFT
@orhtej2,@Francesco B. At this moment, The closest document I can find is docs.microsoft.com/en-us/nuget/create-packages/…, It said "Namespace-like names: Follow a pattern similar to namespaces in .NET, using dot notation instead of hyphens.".Leo Liu-MSFT

2 Answers

4
votes

How do I diagnose this? How do I fix this? I just want to make sure that the NuGet package works locally before I give it to the rest of the team.

Just as @orhtej2 comment, you should:

you rename it to TDDeviceIntegration.1.0.0.nupkg? (dot instead of space between package name and version).

Additional, some info about why dot is really the only allowed package name-version separator.

That because namespace of nuget package follows a pattern similar to namespaces in .NET, using dot notation instead of hyphens.

You can get the source from following document:

Choosing a unique package identifier and setting the version number

enter image description here

Hope this helps.

2
votes

According to this link from the NuGet GitHub Repository, you can possibly encounter this error when the version of your package is not "normalized", i.e. it's not made up of 4 digits. Yours has 3 digits, so...

(and the last digit might have to be 0).