如何解决在TeamCity中创buildFileSet的NAnt错误?

我正在使用TeamCity构build并部署到我们的演示站点。 我们有一个名为HTML Demo Site的configuration,其中一个构build步骤是使用NAnt将HTML部署到网站。

构build文件已经定义了一个目标:

<target name="deploy-html" description="Deploys the HTML to the demo server"> <echo message="Deploying HTML to the demo server..."/> <copy todir="\\<server>\<dir>\<client>" includeemptydirs="true" overwrite="true"> <fileset basedir="..\html\_master"> <include name="**\*"/> <exclude name="node_modules\**"/> </fileset> </copy> </target> 

每次我在TeamCity上运行构build时,都会失败,出现以下错误:

 C:\tc\w\9149e011dfa8657d\build_scripts\website.build(27,14): [NAnt output] Error creating FileSet. [NAnt output] 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. 

所以我试着在PowerShell上运行以获取超过最大长度的文件列表:

 Get-ChildItem -Recurse | Where-Object {$_.FullName.Length -gt 248} 

但是唯一返回的文件是node_modules目录下的文件。 但在构build文件中,它被排除在外。 所以我不知道还有什么可以看的? 有任何想法吗?

你可以尝试几件事情:

  • 首先删除node_modules目录
  • <exec>任务中使用robocopy /mir
  • 包括之前尝试排除(不可能,但值得一试)
  • 尝试将pathexpression式更改为name="node_modules\**\*"name="**\node_modules\**"或类似的

删除首先为我工作 – 但内置的nant删除任务也有问题,所以我不得不使用rmdir控制台命令

 <exec program="${environment::get-variable('WinDir')}\system32\cmd"> <arg value="/c &quot;rmdir /q /s ${Build.BuildFolder}\WebApplication\node_modules&quot;" /> </exec> 
    Interesting Posts