路径长度太长时 TeamCity DNU 发布失败

TeamCity DNU publish fails on path length too long

由于路径长度最终失控,我的 DNU 发布步骤在 TeamCity 中失败:

[14:35:29][Step 1/1] Using Package dependency Microsoft.Extensions.Configuration.FileProviderExtensions 1.0.0-rc1-final
[14:35:29][Step 1/1]     Source C:\Users\TFSSERVICE\.dnx\packages\Microsoft.Extensions.Configuration.FileProviderExtensions.0.0-rc1-final
[14:35:29][Step 1/1]     Target D:\TeamCity\buildAgent\work745f64510dfced\artifacts\Company.Auth.IdentityProvider\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions.0.0-rc1-final
[14:35:29][Step 1/1] Using Package dependency Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc1-final
[14:35:29][Step 1/1]     Source C:\Users\TFSSERVICE\.dnx\packages\Microsoft.Extensions.FileSystemGlobbing.0.0-rc1-final
[14:35:29][Step 1/1]     Target D:\TeamCity\buildAgent\work745f64510dfced\artifacts\Company.Auth.IdentityProvider\approot\packages\Microsoft.Extensions.FileSystemGlobbing.0.0-rc1-final
[14:35:29][Step 1/1] Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
[14:35:29][Step 1/1] Process exited with code 1
[14:35:29][Step 1/1] Step DNU publish (Command Line) failed

我已经更新了我的结帐规则代理路径,使项目根目录更接近构建代理目录。

一个可能的解决方案是将发布输出设置为更接近驱动器根目录。但是,TeamCity DNU 发布构建步骤不支持更改输出目录。此外,我将负责管理此目录。

理想的解决方案是对构建代理进行最少的手动配置,因为我有几个。

一个可能的解决方案是修改 Team City 构建代理配置以使用较短的工作文件夹路径。即改变

D:\TeamCity\buildAgent\work

类似于

D:\work

甚至

D:\w

您可以使用特殊的短名称共享文件夹。

您也可以在这里找到 similar question,但答案很少。

我们(ASP.NET 团队)使用 TeamCity 并在 Windows 上达到了路径限制。不幸的是,这是由 node.js 路径引起的,我们无法控制它,因此我们不得不将工作目录移动到更靠近驱动器根目录的位置。现在在 D:\ba(ba = build agent)。

因此,我现在为您提供的唯一解决方案是尝试让项目更接近驱动器的根目录。

The DNU publish command appears to operate correctly on Windows 10, but not any prior Windows version, including Server 2012 R2. As of now, I can only suspect warlock black magic (converting to NT paths and back?)

dnu 应该适用于 Win 7(带有最新的 SP)、Win 2008 R2、Win 8、Win 2012、Win 10 和 Win 2016 Server。如果您遇到特定平台的任何问题,请在 Github (aspnet)

上打开一个错误