Dealing with pending removal when upgrading nuget packages in TFS

We have a Nuget package that we developed on our own and adds several MVC-related assets to any project that draws it into the Index.cshtml in the Views\Home , HomeController and Controllers folder and the Content folder with some static files (among others )

Each time we create a new version of a package and transfer it to a project under the control of the TFS source, the current version of the package is first deleted (standard Nuget behavior). This causes all assets to be placed in a pending delete state in the original control. Whenever a folder is cleared of all files, this folder is also placed in a pending delete state.

When the new version of the Nuget package is installed, the package manager throws errors because the objects that it is trying to copy are already installed for deletion, or the parent is set to be deleted in folders.

Is there a way to deal with this situation, either by forcing TFS to efficiently recover assets when installing a new package, or not to delete them first of all when uninstalling?

+4
source share
1 answer

While there are hooks and ways in which you can handle this (by connecting to IVsPackageInstallerEvents or by running init/install/uninstall.ps1 , it may be easier to use Nuget package recovery.

The recommended practice is not to check the packages folder in the source control, but to use NuGet package recovery to restore packages during build. More details here .

0
source

Source: https://habr.com/ru/post/1499431/


All Articles