4

We have a Nuget package that has been developed in-house and adds a number of MVC-related assets to any project that pulls it in - an Index.cshtml view in the Views\Home folder, a HomeController and Controllers folder and a Content folder with some static files in (amongst others).

Every time we create a new version of the package and pull it into a project that is under TFS source control, the current version of the package is uninstalled first (standard Nuget behaviour). This causes all of the assets to be placed into the pending delete state within source control. Whenever a folder is emptied of all files, that folder is also placed into the pending delete state.

When the new version of the Nuget package is then installed, package manager throws up errors because the assets it is trying to copy over are already set to delete, or the parent is set to delete in the case of folders.

Is there a way to deal with this situation, either by forcing TFS to effectively undelete the assets when installing the new package or not to delete them in the first place when uninstalling?

4

2 回答 2

0

虽然有一些钩子和方法可以处理这个问题(IVsPackageInstallerEvents通过脚本连接或管理它init/install/uninstall.ps1,但使用 Nuget 包还原可能更容易。

建议的做法是不要将“包”文件夹签入源代码管理,而是在构建期间使用 NuGet 包还原来还原包。更多信息在这里

于 2013-08-28T16:54:17.967 回答
0

我相信这已在最新的 TFS/Visual Studio/Nuget 组合中得到修复。

所以坚持住,有希望。

但是,对于我们这些仍然停留在较旧版本的人来说,我发现手动从 packages.config 中删除包条目最简单,然后使用 nuget 包管理器安装(而不是更新)最新版本的包,最少副作用。

于 2020-02-28T14:15:47.610 回答