Visual Studio Online - Get Latest and NuGet - visual-studio

It's very possible that I'm missing something simple because I can't find others on the internet experiencing the same thing.
I'm a team that's new to the use of TFS and Visual Studio Online and we're encountering this problem:
(Using Visual Studio 2015 & 2013)
I used NuGet to add Microsoft.AspNet.WebApi.Cors to my newly created WebAPI project (ditto all other NuGet packages)
Did my work and checked in a building solution in to VSO
Co-worker did a Get Latest
His newly-retrieved project won't build and, when we expand the References, the assemblies are marked with a yellow warning icon, indicating that they're missing
We've tried (from the context of the failing project):
Update-Package
Update-Package -reinstall
Manually uninstalling and reinstalling the package in the NuGet UI
Manually adding the entire contents of the Packages directory in to TFS and doing a get latest on that directory as well
Wiping the solution out from his local file system and pulling it down clean
Copying the contents of my {Solution Directory}\Packages to a USB drive, walking it to my co-worker's computer, and copying it to his machine
Only item #6 worked but I'm CERTAIN that this cannot be the right answer.
I guarantee that this is worthy of a dope-slap but what might I be missing?

Thank you to jessehouwing for reminding me that this topic is still out here. He's exactly right on. We removed the Packages folder from source control and that resolved the problem completely.

Related

Visual Studio Could not find a part of the path system.net.http while checking in to TFS

I have a solution that compiles and runs fine. However when trying to check it in to TFS I get the error :
"Could not find a part of the path C:\pathToMyProjects\MyProject\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll".
I recently installed Visual Studio 2017 while the project was last checked in to TFS while being built in Visual Studio 2015 if that has anything to do with it.
I've removed System.Net.Http from references and Nuget packages. Even when all are uninstalled I get the same error. Any clues as to how I can figure out what the real issue is?
The error you have is mainly caused when you're trying to check in files which is no longer exist on the machine.
This will happen when TFS has some changes staged that no longer exist
on the file system. For instance, if you add some files in Visual
Studio (which adds them to the changes list), delete them directly
from the file system, then attempt to check in the changes, it will
complain that it could not find the file(s).
Just try below things to narrow down the issue:
Check if the file exists under the the specific path mentioned in the
error message.
Go to Source Control Explorer -> select these nonexistent files
-> Undo Pending Changes. Or you can just left these files in the Excluded Changes list to not check in them.
Re-install/upgrade Nuget packages in Package Manager Console:
PM > update-package System.Net.Http -r
Uninstall the System.Net.Http Nuget packages and remove the reference, then reinstall the System.Net.Http Nuget packages and add the reference again.
Clean and rebuild your whole solution, once that compiles and runs
fine locally, then try to check in the changes again.
Check if this issue also occurs on other VS machines, so we could
know that whether it is related to the VS Environment or others.

Error while adding NuGet Package

I am getting the following exception while adding NuGet package to project. I am using the latest version of Visual Studio 2017 Pro.
try going to VS settings -> NuGet settings -> clear the NuGet cache, close Visual Studio, and delete all obj and bin folders in solutions .
Error while adding NuGet Package
AFAIK, It seems an issue which needs to be fixed from Xamarin team and someone already reported it:
https://bugzilla.xamarin.com/show_bug.cgi?id=61113
You can track this thread to get future updates for this issue.
Here are some of the workarounds already mentioned in that thread:
Update the packages with the option -IgnoreDependencies in the Package Manager Console (It works for me):
Update-Package -IgnoreDependencies
Update Visual Studio to latest version and running as Administrator
Some of the files in the packages folder were set to read-only. Try to cleare the read-only flag from all files in the packages folder.
Hope this helps.
I tried a lot of ways to solve this problem. But unfortunately cleaning the cache, project, rebuilding didn't help. The only thing I didn't try is to re-install Visual Studio or Windows.
I've got to launch project in Visual Studio for Mac and update/add all the necessary Nuget packages from there. On the Mac, the process was successful. I know this might not be an option if you don't have device, but it definitely works.

Confusion over NuGet in Visual Studio

Our VS2013 solutions contain a solution folder called .nuget, containing the files NuGet.config, NuGet.exe, NuGet.targets. What is the significance of this folder and what uses the files? Is it related to the "enable package restore" feature?
If I install or update a package (via the "Manage NuGet Packages" UI or package manager console), does this involve running the above NuGet.exe, or something else? VS is telling me that the NuGet Package Manager is up to date (via the Extensions and Updates dialog), however the above NuGet.exe is quite old. I've also found a very old NuGet.exe file in C:\Program Files (x86)\NuGet\. What uses the latter, and what are the implications of these exes being out of date?
The reason I ask is that we've been having problems with a couple of solutions over recent weeks. We can't update NuGet packages - the operation fails with the message "Error: An item with the same key has already been added". I'm trying to track down the cause, and wondering if these out of date NuGet.exe files might have something to do with it.
As far as I remember this folder is useless now with the latest nuget extension to Visual Studio. It was used before and was nothing but pain in the ass. I am not 100% sure about 2013, but in 2015 all works fine without it, so my suggestion is to update to the latest available nuget extension version and try to delete the folder, most likely everything will work.
Now packages go to current user folder, and use the config from %AppData%\NuGet\NuGet.config. For NuGet 2.6 or earlier, this setting was available in a project-specific .nuget\nuget.config file.
You can read more about it here.
So nuget is gradually getting better and easy to use without too much thinking of all this "magic" folders and stuff.

"Enable NuGet Package Restore" is gone in VS 2015

I am having serious problems getting Solutions to build in Visual Studios 2015. Before I would just click "Enable NuGet Package Restore" in Visual Studios 2013 and everything comes in just fine.
I see this exact same question how-to-enable-nugets-package-restore-in-vs-2015
the answer was:
delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.
pardon my French, but besides this being bullshit. The fact that you have to manually go into every single project in your solution and mess around , it also is not working for me. Maybe the guy that wrote this had 3 or 4 projects , I have 30+ that are referenced.
That was back in June , has anyone found a working or simpler way to achieve this functionality that was working perfectly prior to VS 2015?
This setting is on by default since NuGet 2.7. Use a small Powershell script to migrate from the old MSBuild to the automatic restore of 2.7 to fix your issues.
When a package is not installed you see this dialog at start of the build process where NuGet restores the missing package:

Visual Studio + nuget + TFS: checking in nuget packages?

I'm working on a TFS project with a small team. This project has a bunch of nuget packages installed, but it's for a 4.0 project, and the nuget package manager GUI doesn't even offer the older versions of the packages any longer since their 4.5 equivalents are now being used. In order to allow other team members to compile the project, they need to have the exact versions of the packages. I'd like to check in the entire "packages" folder used by nuget. Is this a good idea? If so, how does one check in the "packages" folder and all its contents since it exists at the solution level? There is no "Include in Solution" option in Visual Studio as there is when you right-click an assembly.
in the past I have also checked in the NuGet packages into version control. With this some problems appeared:
Some packages where not checked into version control when committing from Visual Studio into TFS.
Updating packages became a real problem.
For the first problem I had used the TFS Power Tools. The problem with this solution is that every developer needed to install the Power Tools.
A better solution came up with NuGet 2.7. It introduced package restore. With package restore there's no need to check-in the packages folder. They will be restored during build.
We use an on-prem TFS install with no internet access so we have to check in our package folders or our builds fail. The biggest issue is that VS does not behave consistently when it comes to adding the pending changes for new package files, often times it will ignore the .dll files in the pending changes window, sometimes it adds everything fine.

Resources