File not found during build on secondary workstations in RAD Studio
0 reputation · 13 Mar 2025, 12:26 UTC
0 reputation · 13 Mar 2025, 12:26 UTC
Maintaining a repeatable development environment in RAD Studio requires consistent search paths across multiple developer machines. While the IDE allows the definition of search paths within the .dproj file, the use of absolute paths often leads to build failures when the project is cloned to a different workstation where the directory structure differs.
The goal is to implement a configuration that avoids hard-coded absolute paths while ensuring the compiler can resolve all dependencies across diverse environments.
Given the behavior of the Project Options manager, what are the best practices for utilizing environment variables or relative paths within the search path settings to ensure build repeatability? How does RAD Studio handle the resolution of these variables during the build process across different versions?
29275 reputation · 14 Mar 2025, 00:23 UTC
Use relative paths anchored to the project directory for anything inside your repository, and use environment variables (in $(VAR) form) only for machine-level locations such as third-party library roots. Never commit absolute paths like C:\Users\alice\libs into a .dproj file — that is precisely what produces 'file not found' errors on secondary workstations.
RAD Studio's build is MSBuild-based. When the compiler processes the Search Path, Unit Scope Names, and Library Path entries from Project Options, it expands MSBuild-style variables and environment variables at build time on the machine doing the build. Relative paths are resolved against the project directory (the folder containing the .dproj/.cbproj), not against the current working directory of the IDE. This behavior is consistent across modern versions (RAD Studio 10.x through 12.x), though the exact set of predefined variables has grown over time.
Commonly useful variables include:
$(PROJECTDIR) — the project's own directory.$(BDS), $(BDSLIB), $(BDSINCLUDE) — the RAD Studio installation folders, so product files resolve regardless of install drive.$(Platform) and $(Config) — for per-platform/per-configuration output folders.$(THIRDPARTY_ROOT), if you define one.libs\, thirdparty\) and reference them as ..\..\libs\someunit or $(PROJECTDIR)\..\libs in Project Options → Delphi Compiler → Search Path. Commit the whole layout to version control so a clone is self-contained.VENDOR_SDK=D:\SDKs\VendorX) and reference $(VENDOR_SDK)\source in the search path. Document the required variables in the repo README..dproj.Separate what you can confirm from what you suspect. Confirm first:
.dproj in a text editor and search for the failing filename. Check whether the entry is absolute, relative, or variable-based.msbuild MyProject.dproj /t:Build /p:Config=Debug /p:Platform=Win32 /v:detailed
The detailed log shows the resolved search path, which immediately reveals whether a variable expanded to an empty string (undefined on that machine) or a relative path resolved to a nonexistent folder.
Two assumptions worth verifying in your environment: first, that all workstations run the same RAD Studio version and update level, since variable definitions and default paths differ between releases; second, that mapped drives are not involved — a relative path that silently depends on a drive letter mapping (e.g. Z:\dev mapped differently per user) fails exactly like an absolute path. If the error message names a specific file, that filename and whether it lives in your repo or a third-party install would determine which of the two strategies above applies.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.