I've added several Nuget packages to my multi-project solution with no issues. However, when I add this package -- ews.x64 (Exchange Web Services API) -- Nuget does not allow me to add it to any particular project.
The packages subfolder is created normally:
D:\TFSSource\Exchange\Utilities\Src\ExchangePurge\packages\EWS.x64.1.2
but when you attempt to manage the solution's installed packages, the "Manage Nuget Packages" dialog only offers an Uninstall button for this particular package. All the other packages have the Manage button allowing them to be added to the individual projects.
Also interesting is the fact that this package appears in a packages.config file under a newly created solution folder called .nuget? Any ideas what might be causing this?
Looks like this is a solution-level package, a package that doesn't have project specific content or libraries. The package is probably installed correctly and available to all projects at once.
source:NuGet FAQ
Related
I have a Visual Studio, C# solution with several projects. Some of those point to older versions of some packages. my local nuget repo has more current, stable versions. e.g.
What I want to do is update all those old 3.0.246-alpha references to the latest stable version, 3.1.0
What is the best way to do that?
Output window after clicking Install:
errors at top of screen:
This is what I want to fix. There is no version 3.0.246 of that module, so I want Nuget to overide it with latest stable version, 3.1
Due to the limitation, I post this as an answer, but may include some comments.(Sorry for that)
As I searched online(nuget.org), I found no packages called TBSM.*, perhaps they were created by yourself/your company… and just used(saved) locally?
From the error message, it reported that the NuGet package was not found on source XXXXX, so did you perform some operations to remove the old version of the NuGet packages? (Maybe also removed the NuGet cache files?)
I did some tests:
Since I don’t know the specific structures of your projects/NuGet Package, I just created two NuGet packages for test locally with same names(ID) and different versions, and then added the package source path to the settings, and installed the first NuGet package into one project, after that deleted this NuGet package and the cache files. Then tried to Update it, NuGet Package manager could still update it to the latest version successfully, even if I uncheck these options: Allow NuGet to download missing packages and Automatically check for missing packages during build in Visual Studio from VS > Tools > Options > NuGet Package Manager > General.
Of course, I may not remove all of the NuGet packages’ cache files, or the issue is cause by the specific NuGet packages’ structures(cause I used two NuGet packages, but yours maybe used the same one with something updated)…
What I suggest:
1). If it is possible, you can have a try Uninstall and then Install the relates version.(remember to make a backup before this)
2). Try to select this two options in VS(Tools > Options > NuGet Package Manager > General), “Allow NuGet to download missing packages” and “Automatically check for missing packages during build in Visual Studio”, and then click Clear All NuGet Cache(s) button. Make sure you have added the right path source from VS > Tools > Options > NuGet Package Manager > Package Sources and try to install/update the NuGet packages again.(Generally, clear cache will not cause errors, but please remember to make a backup before clearing cache)
We would like to have one solution packages.config rather than individual packages.config at the project level. We have a rather large solution (over 300 projects) and we have had issues with project config like people forgetting to upgrade all projects to a specific version of a package. We realize that it will lock us to a single version of each package across all projects and we are ok with that. I've attempted do this to a few projects by deleting all packages in the project and then trying to re-add them through the solution rather than the project but its just re-adding the package.config at the project level. I even tried to manually delete the project level packages.config file and add them to the solution level and then using the solution level "manage nuget packages" dialog but the same thing happened.
I'm kind of going off this post which is quite old:
Manage packages at the solution level
Dependencies issues with multiple Project packages.config files in solution
You could not consume NuGet package for solution level with package.config. That because NuGet team deprecated solution level packages in NuGet 3.0. So you could not consume NuGet package for solution level with package.config.
Besides, you can use Manage NuGet Packages for Solution.. to manage the packages for all projects in the solution:
Right-click your solution > Manage NuGet Packages for Solution...
or
Tools > Library Package Manager > Manage NuGet Packages for
Solution...
Then add it to all the projects by browsing for your package, then checking the top checkbox, and clicking install.
Or you can simple add following NuGet command line in the Package Manager Console:
Update-Package <package_name> -version
This command line will update package for all projects.
If manage NuGet package at solution level is your persistence, you can consider Martin`s advice using PackageReference.
Hope this helps.
I setup an internal NuGet server to host internal dll packages. The setup went smoothly. The spec and nupkg were created successfully. However, when I launch a test project and attempt to install it from Manage NuGet Packages it fails.
The internal package shows up under Manage NuGet Packages with an install button. I hit install but it does nothing. I check my references folder and saw nothing added.
If I check the Manage NuGet Packages at solution level, it has a green check mark indicate that it's installed but doesn't give me a Manage option to see which project it was installed to.
My issue is somewhat similar to this post below. The only difference is that I don't have sub folders for my library. I just have 1 dll and I'm putting the nupkg file directly under the Packages folder.
NuGet package fails to install
I'm not sure what I did wrong. Any suggestions?
Thanks to #MattWard for mentioned that the package got installed at the solution level. I went back to the official documentation here: https://docs.nuget.org/create/creating-and-publishing-a-package to review the differences with creating solution level package vs project level package and most important of all is the nuget naming convention when creating packages (the lib, content, etc. folder). I re-package my dll again with the naming convention and it works!
I'm investigating using NuGet internally to share an assembly used across multiple solutions. Despite the documentation making it look simple, I'm just getting a faceful of problems. I have two questions at this stage:
1) When I create the package, NuGet reports it as having 'no dependencies'. In fact, the assembly's project has quite a few dependencies on other (official) NuGet packages. I assumed that NuGet would spot this. Is there something I need to do so that NuGet knows my assembly itself has NuGet dependencies?
2) When I attempt to add the package to a project in another solution, it doesn't actually add the dll to the project (i.e. in the project's References). The package manager GUI lists the package in the installed list, but doesn't show a 'Manage' button, as it does for other packages. Instead, it just shows a 'Uninstall' button. So it's as if the overall solution is now aware of my package, but I can't add it as a reference to any projects, which is obviously of no use. This happens regardless of whether I install using the GUI or the command line. Does anyone know why this might be happening?
Thanks in advance.
For issue 1, if you are using nuget.exe pack and your project installed certain packages, these packages will be added as dependencies. If the packages are installed to another project that the main project is referencing, do nuget.exe pack -includereferencedprojects. For more information, please refer to http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command_Examples.
For issue 2, you have probably installed a solution-level package, which does not have Content or Lib folder inside. If you install a project-level package, you should be able to see the manage button.
Hope this helps.
I have been using NuGet to manage my internally created assemblies for a few months, and it's working very well. I recently 'discovered' portable class libraries, which has also been great - until it's time to install the packages.
Say I have a PCL that targets .NET 4.5, SL5 and .NET for Windows Store Apps. I run nuget spec to create the .nuspec file, edit the values, package it up, and add the .nupkg to our internal feed. If I open the .nupkg file in the Package Explorer, I see one content folder under lib called portable-win+net45+sl50.
When I try to install the package from any compatible project in another solution, I get the following message:
"'Project.PCL' could not be installed because it is not compatible with any project in the solution. The package doesn't target any framework."
If I manually create the .nupkg in the Package Explorer, updating the version number, adding a lib folder for each targeted framework (not a portable folder) and added the Project.PCL.dll to each folder, I can add the package to the compatible projects in the solution. But to do this process every time I want to update a PCl is somewhat tedious (I had been creating a little .cmd file in the project root folder to quickly package and deploy).
Do other people have this problem? How can I package PCL's in the same way as other types of projects?
Note - I'm using VS 2012 Ultimate and NuGet 2.2
It sounds like maybe nuget spec doesn't work for Portable Class Libraries - that's worth starting a thread or filing an issue on the NuGet site.
However, you can also create a .nuspec file from NuGet Package Explorer. Just create the package as you already did, but then choose "Save Metadata As..." to save it as a .nuspec. Afterwards you may need to edit the source paths in the nuspec file manually, but you should be able to automate the creation of the package.
For me nuget spec and nuget pack worked fine with a portable project while creating the package and installing it on a compatible project.
Do you want to check if you have the latest nuget.exe (2.2), it can be downloaded from http://nuget.org/nuget.exe or can be updated by running nuget update -self