Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Package updates & Package.config remove issue (TF400024)

Tags:

We are having issues with NuGet package updates and TFS source control integration lately. This is causing allot of hassles with our team and making us hesitate in adopting NuGet packages fully.

The issue/bug: instead of updating certain projects "package.config" files, they are being removed from the file system (and marked as deleted within TFS source control) I can't work out why.

The behavior we are seeing is the following:

  1. Open in solution (approx. 18 projects) in VS.NET 2012
  2. Initiate a solution level package update to the latest version via the Package Management Dialog, as described here.
    • The package.config exists and part of the project(s) within said selected solution.
    • Theses packages.configs are NOT checked out of TFS yet.
  3. NuGet package update occurs, select package.config are removed from project and marked as deleted within TFS and references remain in project updated to current version.
  4. Obviously, this means that when I check in the solution and project the packages.config will be removed, making future updates (I believe) painful as above project will fall off NuGet's radar.
  5. I notice this and Undo Check-Out & get this error:

    TF400024: The change on xxx\packages.config cannot be undone because a file already exists at xxx\packages.config. The file must be deleted from disk for the undo to succeed. 
    • Interesting, to TFS the file is marked as deleted yet it still resides on my file system?

The output provided by Package Manager listed below does not indicate any issues for the project in which the package.config was removed.

Updating 'NugetPackageAssemblyA' from version '1.5.18.0' to '1.5.23.0' in project 'CommonUnitTests'.  Removed reference 'AssemblyAA.dll' from project 'CommonUnitTests'  Removed reference 'AssemblyBB.dll' from project 'CommonUnitTests'  Removed reference 'AssemblyCC.dll' from project 'CommonUnitTests'  Removed reference 'NugetPackageAssemblyA.dll' from project 'CommonUnitTests'  Added file 'packages.config'.  Removed file 'packages.config'  Successfully removed 'NugetPackageAssemblyA 1.5.18.0' from CommonUnitTests.  Added reference 'AssemblyAA' to project 'CommonUnitTests'  Added reference 'AssemblyBB' to project 'CommonUnitTests'  Added reference 'AssemblyCC' to project 'CommonUnitTests'  Added reference 'NugetPackageAssemblyA' to project 'CommonUnitTests'  'packages.config' already exists. Skipping...  Successfully added 'NugetPackageAssemblyA 1.5.23.0' to CommonUnitTests. 

DEV. Environment Stats:

  • Nuget Package manager: version 2.2.40116.9051
  • Visual Studio 2012: version 11.051106.01 Update 1

Is there anything I'm missing?

like image 639
darthal Avatar asked Mar 15 '13 20:03

darthal


People also ask

How do I update my NuGet package?

On the Installed tab, select a package, record its name, then select Uninstall. Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install .

Should you update NuGet packages?

Well, you should update whenever you are able to cope with it. So you need to think carefully about the regression updating the packages could cause to your application if already in production, or the extra tests you are going to need to carry on in order to verify everything seems to be working as expected.

How do I update NuGet with latest version?

Right-click the Packages folder in the project, and select Update. This will update the NuGet package to the latest version. You can double-click the Add packages and choose the specific version.

How do I refresh a NuGet package in Visual Studio?

Restore packages manually using Visual StudioEnable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.


1 Answers

A simple check-in of the code to Visual Studio Online did the trick for me.

like image 111
RHAD Avatar answered Oct 04 '22 20:10

RHAD