7
votes

I'm trying to build some Delphi XE projects using msbuild. While most work without a problem, some projects which have a lot of (and long) search paths, fail to build with this error message:

MSB6003: The specified task executable could not be run. The filename or extension is too long

I found the reason for this: I add differing search paths via /p:DCC_UnitSearchPath= some of which are not in the dproj file. This makes the command very long and msbuild fails.

So basiacally what I want to do here is just use the unit search paths I am setting via DCC_UnitSearchPath but exclude / ignore the search paths from the dproj file.

Is there a way to achieve this?

Thanks,

Greg

1
My way of dealing with this is to have an empty search path and include all units in the project - David Heffernan
Problem with this is, that we have >500 projects each with search paths that differ for varying build configurations. We're using extra build files to be able to use these varying configs with FinalBuilder, but we now want to use msbuild for some projects. So putting all units into the projects is not an option for me. - Greg
I've been thinking about this a little more. Why do you specify search paths at the command line? Why aren't they set in the .dproj file? - David Heffernan
You should use different configurations in the .dproj file to effect that. You should not need to specify that data at the command line. The command line builds should build exactly the same as can be achieved in the IDE. That makes testing and debugging much cleaner and more robust and reliable. You need option sets and inheritance of configuration. Interestingly this is one area where RAD Studio completely crushes VS. VS sucks so bad at this. But RAD Studio gets it spot on. Big up for Emba here. - David Heffernan
I finally figured the reason for this: XE's own library path had too many entries; I removed more than a dozen paths and now it works. - Greg

1 Answers

6
votes

Move parts of your search path to environment variables to access Spring4D, DSharp and VirtualTreeView:

DSharp=C:\Users\Developer\Versioned\DSharp
Spring4D=C:\Users\Developer\Versioned\Spring4D
VirtualTreeView=C:\Users\Developer\Versioned\VirtualTreeView

Then in your configuration specify them like this:

$(DSharp)\Source\Aspects;$(DSharp)\Source\Bindings;$(DSharp)\Source\Collections;$(DSharp)\Source\ComponentModel;$(DSharp)\Source\Core;$(DSharp)\Source\Logging;$(DSharp)\Source\PresentationModel;$(DSharp)\Source\Validation;$(DSharp)\Source\Windows;$(Spring4D)\Source\Base;$(Spring4D)\Source\Base\Collections;$(Spring4D)\Source\Core\Container;$(Spring4D)\Source\Base\Reflection;$(Spring4D)\Source\Core\Services