如何解决 (Jenkins) msbuild-by-convention 问题路径中的非法字符?
How to solve (Jenkins) msbuild-by-convention issue illegal characters in path?
对于 C# 项目,我使用的是 Jenkins 构建服务器。为了构建 C# 项目,我使用 msbuild-by-convention。自 2 个月前以来,每次构建尝试都发生错误。
(SetAssemblyFileVersion target) ->
C:\WORKSPACE\Backend\Back-End\msbuild-by-convention\Scripts\targets.msbuild(207,3): error MSB4018: The "Attrib" task failed unexpectedly. [C:\WORKSPACE\Backend\Back-End\Build\Scripts\main.msbuild]
C:\WORKSPACE\Backend\Back-End\msbuild-by-convention\Scripts\targets.msbuild(207,3): error MSB4018: System.ArgumentException: Illegal characters in path. [C:\WORKSPACE\Backend\Back-End\Build\Scripts\main.msbuild]
错误发生在这个build-step/method:
<Target Name="SetAssemblyFileVersion">
<!-- set correct file version -->
<ItemGroup>
<AssemblyInfoFiles Include="$(CSharpSourceDirectory)**\AssemblyInfo.cs" />
</ItemGroup>
<Attrib ReadOnly="false" Files="@(AssemblyInfoFiles)" />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="\[\s*assembly\s*:\s*AssemblyVersion\s*\(\s*"[\d\.\*]+"\s*\)\s*\]" ReplacementText="[assembly: AssemblyVersion("$(BuildVersion)")]" Condition=" @(AssemblyInfoFiles) != '' " />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="\[\s*assembly\s*:\s*AssemblyFileVersion\s*\(\s*"[\d\.\*]+"\s*\)\s*\]" ReplacementText="[assembly: AssemblyFileVersion("$(BuildVersion)")]" Condition=" @(AssemblyInfoFiles) != '' " />
</Target>
我没有更改我的构建脚本并且在它工作之前。有谁知道如何解决或调试这个问题?
非常感谢,
乔迪
很有可能是权限问题。暂时尝试向每个人授予对您的@(AssemblyInfoFiles) 文件的完全访问权限(如果可行,那么您可以根据需要更改该文件的安全权限。)
对于 C# 项目,我使用的是 Jenkins 构建服务器。为了构建 C# 项目,我使用 msbuild-by-convention。自 2 个月前以来,每次构建尝试都发生错误。
(SetAssemblyFileVersion target) ->
C:\WORKSPACE\Backend\Back-End\msbuild-by-convention\Scripts\targets.msbuild(207,3): error MSB4018: The "Attrib" task failed unexpectedly. [C:\WORKSPACE\Backend\Back-End\Build\Scripts\main.msbuild]
C:\WORKSPACE\Backend\Back-End\msbuild-by-convention\Scripts\targets.msbuild(207,3): error MSB4018: System.ArgumentException: Illegal characters in path. [C:\WORKSPACE\Backend\Back-End\Build\Scripts\main.msbuild]
错误发生在这个build-step/method:
<Target Name="SetAssemblyFileVersion">
<!-- set correct file version -->
<ItemGroup>
<AssemblyInfoFiles Include="$(CSharpSourceDirectory)**\AssemblyInfo.cs" />
</ItemGroup>
<Attrib ReadOnly="false" Files="@(AssemblyInfoFiles)" />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="\[\s*assembly\s*:\s*AssemblyVersion\s*\(\s*"[\d\.\*]+"\s*\)\s*\]" ReplacementText="[assembly: AssemblyVersion("$(BuildVersion)")]" Condition=" @(AssemblyInfoFiles) != '' " />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="\[\s*assembly\s*:\s*AssemblyFileVersion\s*\(\s*"[\d\.\*]+"\s*\)\s*\]" ReplacementText="[assembly: AssemblyFileVersion("$(BuildVersion)")]" Condition=" @(AssemblyInfoFiles) != '' " />
</Target>
我没有更改我的构建脚本并且在它工作之前。有谁知道如何解决或调试这个问题?
非常感谢, 乔迪
很有可能是权限问题。暂时尝试向每个人授予对您的@(AssemblyInfoFiles) 文件的完全访问权限(如果可行,那么您可以根据需要更改该文件的安全权限。)