TFS does not allow the NuGet packages to be installed/Updated - tfs

I am in VS2015/TFS environment and I have been having this constant issue with TFS Source Control:
Every time I want to install the package, it fails with following error
Install failed. Rolling back... Package 'jQuery.Cookie 1.4.1' does not
exist in project 'Web'
This is the same exact error that I see every time I try to install any of the packages.
Currently, I have been taking a copy of my project folder and then put it somewhere where I do not have any SourceControl, then I install the package and copy it back to its original location
The only problem with this approach is that it is a lot of tedious work everytime I want to install a new package
Also, all the packages installed in this manner are not recognized by the source Control and that is why I have to add each file saperately. Not to mention that since it is not as accurate as having Nuget taking care of everything for me, sometimes I miss to check in some of the files and it breaks things on the server.
Can someone guide me on how can I smoothly install an new NuGet package on VS 2015 without having to go through this tedious process?

It seems to be caused by the bug in old nuget version: Install package fails when solution/project is bound to TFS source control
Update nuget to latest version and then try again.

Related

Update Packages of a MVC Project

Im trying to use an ASP.NET web application downloaded from the internet. Im looking for a way restore all the dependencies/packages in a quick way (clean and building the project did not solve it), rather than installing them via nuget one by one. Is there anyway to download and install/resolve (version issues) all the necessary packages at once?
I tried below package manager console commands, but they did not resolve the package conflicts.
Update-Package -Reinstall,
nuget install packages.config and other solutions here - How do I get NuGet to install/update all the packages in the packages.config?
[resolve/install packages]
Can someone help? Maybe Im using wrong commands or doing something wrong.
If you go into Tools > Nuget Package Manager > Manage Nuget Packages for Solution, it will show a yellow bar at the top asking you if you want to restore missing packages. That's a manual way, but there are also some important VS options you want to look at as well, one being an option to restore packages on build.
There is a generic restore option as well from the package manager console, and that should have worked if it was simply a matter of reimporting the missing packages...
Update-Package -reinstall
You can try to delete the folders, than reinstall using these options. However, is there a possibility there is a .NET framework version mismatch with the version of the DLL's? Maybe some of the DLL's need updated?
Remove package folders from Package folder - don't remove package.config. Next, build you application - nuget should automatically restore all packages.

RdKafka setup not finding/recognizing librdkafka in Visual Studio

Issue: RdKafka setup is not finding/recognizing librdkafka in Visual Studio 15
Context:
In order to get started with RdKafka in visual studio 15, I ran the generic paket+nuget setup command (via powershell): paket add nuget rdkafka
After this, I see RdKafka has been installed successfully in my solutions package location. I also see a librdkafka package present.
Adding RdKafka as a reference in my solution works as well (I can't add the librdkafka dlls due to an error message from the IDE).
However, trying to run anything using librdkafka leads to a library not found.
What I've tried:
Removing rdkafka completely and paket reinstalling/updating/restoring
Cleaning + re-building the solution in IDE
Moving the librdkafka package around/including it in path
All the above to no success
Any suggestions on how to proceed?
So, it turns out someone else on my team figured out how to make this work, though admittedly it's a little bit of a hack. VS allows for pre-build events (Found by right clicking on your project > Properties > Build Events > Edit Pre-Build). And in there I dropped in the following:
{xcopy /y /d /f
"$(ProjectDir)..\packages\RdKafka.Internal.librdkafka\runtimes\win7-x64\native*.*"
"$(TargetDir)"}
And just like that, it works. The explanation for the above is that we pull the native dlls that cannot be referenced directly by copying them into our projects target directory just before the build is done.
Hopefully, this helps some future folks, who don't consider rewriting the library into an referable form, like I did.

TFS204018 error when installing NuGet Package in VS2015

Whenever I install a NuGet package in a TFS source-controlled VS 2015 project, I get a message similar to the following output under "Source Control - Team Foundation":
TF204018: Could not check the file's encoding because the file C:\TFS\Oz.Interfaces\Main\Source\MVRSTamperCodes\MVRSTamperCodes.Web\web.config is in use.
I've been searching fruitlessly to see if there's a way to fix this issue and haven't found anything yet. Does anyone know what is causing this message and/or what steps I can take to fix it? I should note that this doesn't prevent the successful installation of the NuGet package so it appears to just be a warning or informational message.
I've met similar issue with blocking web.config and other files. My solution was:
Uninstall NuGet Package Manager (Tools -> Extensions and Updates)
Install newest version (currently: Nuget 3.2)
If you're using Team Foundation Server, you will need to first check out the entire project, before updating Nuget Packages for the project, if you have this problem.

MVC Nuget Installing Multiple Packages

I'm building a new solution/project. I copied all the files over and moved all the packages over to the packages folder. When I reference them via nuget, it says they are installed, but
they are not. If they were, I would see them in the installed tab.
First why does it say installed, next how can I install multiple packages at once, instead of
doing it individually. I have like 10+ packages I need to install. This is pain in
the ass, if I have to install each individually. We should be able to run a command that
checks to see if all the packages in the package folder have been installed, if not, install them. Is there a command for this?
Use nuget.exe for this. see following question and google search
nuget install packages.config
Or with NuGet 2.7 you can restore allpackages in the solution using the command line.
nuget restore YourSolution.sln

NuGet doesn't show installed packages

I have MVC 5 project and I use NuGet to install packages. Yesterday I have installed a couple of packages, but today when I run my application I got an error of missing references. I've realized, that my project doesn't have any of references and files that were added from NuGet.I have all this packages in packages folder in my app, but no records about this packages in packages.config file. If I click Manage NuGet Packages in my solution explorer, in online search it shows me all my packages as installed, but in all installed tab it doesn't show me any of them! I didn't do anything since yesterday? What could happened and how to fix all my packages?
I have had this happen from time to time. There are two things that you can try:
Right click your solution in 'Solution Explorer' and select 'Enable NuGet Package Restore'
Close and Reopen VS
Try Rebuild
Otherwise, just uninstall/reinstall each package.
Hope that helps!
Sometime you added new package does't support to your .net framework which is currently active, so active related .net framework as well.
I just have experienced the same problem. In my case, two different versions of a sample package in the packages.config file causing the problem. After removing the older version of the package from the file, VS shows the list normally.

Resources