Nov 102013
 

When I updated to Windows 8.1 my Delphi 2007 installation broke. I could no longer open projects in the IDE and my command line compilation scripts also stopped working. It turned out that some files that were added by the installer to the dotNET framework were missing. In addition there is a known problem with Delphi 2007 on 64 bit Windows (starting with Vista).

This is the error message from the IDE:

MissingBorlandDelphiTargets

followed by this one which is more readable:

MissingBorlandDelphiTargets2
(click on the picture to get it in full size)

This is the error message from my build script:

D:\src\MyProject.dproj(77,11):
error MSB4019: The imported project
"C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Borland.Delphi.Targets"
was not found. Confirm that the path in the  declaration is correct,
and that the file exists on disk.

You might notice that the error messages slightly vary: The IDE complains about a missing file in …\Framework\ while the build script complains about the same file in …\Framework64\. I’ll come back to that later.

So here is what I did to fix it:

  1. I let Windows search for the missing file Borland.Delphi.Targets and it found it in
    C:\ProgramData\{B59CE2E6-B15A-4F23-BD0E-72BF2ADDC3C7}\core\7EFD2DA3\6C948720
    

    (Unfortunately I had already deleted the backup that was created by the Windows Update process.)
    After looking closer into this directory I found 4 files that match Borland.*.Targets. It stands to reason that Delphi will need them all in one way or another so I just copied all 4 of them to

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
    

    After I did that, the IDE no longer complained and also was able to compile the projects.

  2. To get the command line compile working again there are three options:
    • Some older advice I found on the net said to also copy these files to
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
      

      I didn’t like that approach because the build process is 32 bit, so why should it involve the 64 bit dotNET framework at all?

    • I found that for some reason the rsvars.bat script contained the line
      @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework64\
      

      followed by

      @SET PATH=%FrameworkDir%%FrameworkVersion%;%FrameworkSDKDir%;%PATH%
      

      The Delphi 2007 installer is probably using some outdated method to find the dotNET framework, which works only on 32 bit Windows. I guess this was fixed in later versions.
      So another option to fix the problem is to change the FrameworkDir to point to …\Framework\ rather than …\Framework64\.
      I didn’t really like that approach either so I went for option 3.

    • I changed my build script to work around this issue:
      [...]
      set OldPath=%PATH%
      call "%DelphiDir%\bin\rsvars.bat"
      SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework\
      SET PATH=%FrameworkDir%%FrameworkVersion%;%FrameworkSDKDir%;%OldPath%
      

      (The actual build script is a bit more involved because it allows to call several different Delphi versions depending on an environment variable.)

After this change the build script worked again.

I hope this helps others to fix that problem, but I wrote this post mostly to find this information later if I need it again. 😉

Just in case you are wondering:

Delphi 2006 and 2005 don’t work either. They are missing an older version of the dotNET framework which was there in Windows 8 but vanished in the update process. Thanks Microsoft! But there is a solution.

Delphi 7 still works. Delphi 6 has some issue with not finding its registration information that I haven’t looked into yet.

Sorry, the comment form is closed at this time.

%d bloggers like this: