MSBuild AssemblyInfo CreateItem失败

时间:2012-11-14 16:33:19

标签: msbuild cruisecontrol.net

我们正在从CruiseControl.net运行MSBuild 我们有一个分支,当通过CC在构建服务器上构建时,失败并出现以下错误:

<target name="UpdateAssemblyInfo" startTime="11/13/2012 18:48:35" elapsedTime="00:00:01" elapsedSeconds="1" success="false">        
<error code="MSB4018" file="C:\Continuous Integration Projects\Project\Release\Build\Master.build" line="88" column="5" timeStamp="11/13/2012 18:48:36"><![CDATA[The "CreateItem" task failed unexpectedly.System.IO.PathTooLongException: 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.   at System.IO.PathHelper.GetFullPathName()

更多行的错误继续......

任务在master.build中定义:

<Target Name="UpdateAssemblyInfo">    
    <CreateItem Include="$(SourcePath)\**\Properties\AssemblyInfo.cs">      
        <Output TaskParameter="Include" ItemName="UpdateAssemblyInfoFiles"/>
    </CreateItem>    
    <Attrib Files="@(UpdateAssemblyInfoFiles)" Normal="true" />    
    <AssemblyInfo AssemblyInfoFiles="@(UpdateAssemblyInfoFiles)"   AssemblyVersion="$(CCNetLabel)" AssemblyFileVersion="$(CCNetLabel)"/>  
</Target>

我们怎样才能找出导致问题的AssemblyInfo.cs? 有没有办法将诊断输出添加到master.build文件?

感谢您的任何见解...

2 个答案:

答案 0 :(得分:0)

将MSBuild的详细级别设置为diag并检查输出。假设你正在使用CCNET的<msbuild> task,那应该是它:

<msbuild>
  <!-- ... -->
  <buildArgs>/v:diag</buildArgs>
</msbuild>

答案 1 :(得分:0)

该异常确实说明路径或文件名超过了长度约束。

System.IO.PathTooLongException: 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.

由于AssemblyInfo.cs长度小于260个字符,我们可以推断出它不喜欢路径。

您是否可以检查路径部分是248个字符还是更多?