Reputation: 661
For a C# project I am using a Jenkins buildserver. To build the C# project I am using msbuild-by-convention. Since 2 months ago an error occured during every build attempt.
(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]
The error occurs in this 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>
I did not change my build-script and before it was working. Does anyone have any idea how to solve or debug this issue?
Thanks a lot, Jordy
Upvotes: 1
Views: 888
Reputation: 3326
There are high chances that its permission issue. For time being try giving full access to your @(AssemblyInfoFiles) files to everyone( If it works then you can change the security permission on that file as you want.)
Upvotes: 1