Skip to content

Commit 112c697

Browse files
fix: exclude test projects from ContinuousIntegrationBuild to fix CI test failures
ContinuousIntegrationBuild=true normalises __SOURCE_DIRECTORY__ to deterministic paths (e.g. D:\_) that do not exist at runtime, causing DirectoryNotFoundException when tests try to load CSV data files. Scope the property to non-test projects only by excluding any project whose directory contains '/tests/'. Co-authored-by: Copilot <[email protected]>
1 parent 87a14f6 commit 112c697

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Directory.Build.props

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1818
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1919
<DebugType>embedded</DebugType>
20-
<!-- Deterministic build in CI for reproducible output -->
21-
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
20+
<!-- Deterministic build in CI for reproducible output.
21+
Excluded from test projects because they use __SOURCE_DIRECTORY__ to locate test data files
22+
at runtime; ContinuousIntegrationBuild normalises those paths to non-existent deterministic
23+
paths (e.g. D:\_) which causes DirectoryNotFoundException at test time. -->
24+
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true' AND !$(MSBuildProjectDirectory.Replace('\', '/').Contains('/tests/'))">true</ContinuousIntegrationBuild>
2225
</PropertyGroup>
2326
<ItemGroup>
2427
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" />

0 commit comments

Comments
 (0)