Jump to content
dormky

How do I upgrade an old 2007 project ?

Recommended Posts

I have an old 2007 project that needs to be brought up to 10.3.

However, I cannot compile the project with 10.3 as it seems it cannot recognize any installed libraries (include VCL itself). What do I need to do to migrate the project ?

Share this post


Link to post
14 minutes ago, dormky said:

I have an old 2007 project that needs to be brought up to 10.3.

However, I cannot compile the project with 10.3 as it seems it cannot recognize any installed libraries (include VCL itself). What do I need to do to migrate the project ?

Depending on your project this can get complex and even expensive if you used a lot of 3rd-party libraries.

You can find a good overview here. If you google for "migrating delphi projects" the first hits (for me) list a number of youtube videos that may be useful. There is also a fairly recent book on the topic available: "Delphi Legacy Projects: Strategies and Survival Guide" from William H Meyer.

 

Do not try to open the old project file directly, first delete all files with extensions other than dpr, pas, inc, rc, res from the project directory (after making a backup, of course) and then open the project's dpr file in the 10.3 IDE. That creates a new project (dproj) file. Open the project options dialog and adjust any pathes in the compiler page as required. Make sure to enable all hints and warnings and then try to build the project. The hints and warnings you get even if the build is successful (which is unlikely) will give you an inkling about the magnitude of the task you are facing.

The main pain points are:

  • Ansi to Unicode conversions.
  • 3rd-party components used (i hope you have source code for all of them). Even if D 10 Versions exist for the old components (which you have to buy if commercial) there are likely to be a lot more compatibility issues with them compared to Delphi RTL or VCL code.
  • Database access if you used the BDE (which is dead, buried and cremated for good measure).
  • Assuming sizeof(pointer) = sizeof(integer) (especially if you want to go 64 bit) or sizeof(char) = sizeof(byte) when misusing strings as storage for binary data.

Good luck :classic_cool:

  • Like 1

Share this post


Link to post
40 minutes ago, dormky said:

I have an old 2007 project that needs to be brought up to 10.3.

However, I cannot compile the project with 10.3 as it seems it cannot recognize any installed libraries (include VCL itself). What do I need to do to migrate the project ?

If automatically updating the project (by loading it into the Delphi 10.3 IDE) fails, your best bet is to create a new VCL project and add all units from the original project to it. Then copy all the settings (especially the search path) from the Delphi 2007 project to the new project and fix any problems afterwards. Make sure you retain a copy of the original project so you can always look up any settings. I hope yon still have got Delph 2007 around? Otherwise it might be a bit inconvenient.

 

You do have updated versions of all your 3rd party components or at least their source code, do you? Otherwise you are out of luck.

 

Note that in Delphi 2007 there was no such thing as a base configuration but only one configuration for Debug and one for Release builds. You might want to figure out which settings you want to move to the base configuration an which ones to keep in Debug / Release configurations.

 

Another option, if feasible, might be to upgrade the project through several intermediate Delphi versions since they usually can work well with projects from their immediate predecessor. That would of course require installations of several intermediate Delphi versions, which I don't know if you have them.

Edited by dummzeuch
  • Thanks 1

Share this post


Link to post

Ah, by copying files into a new project I noticed that the search path had some absolute paths pointing to 2007 Delphi, preventing it from being used anywhere other then the original computer... Old projects I swear lol.

Weird that Delphi didn't give any warnings and just said Vcl was not found.

 

Thanks for the pointers to other things I hadn't considered though, that will be useful.

Share this post


Link to post

First I'd try upgrading it to D2010. Get it working there with Unicode characters and deal with other problems that may arise. 

 

The next step would be 10.3.

 

Either way, you're going to need to install the libraries for the desired verion first.

 

Upgrading gives you an opportunity to see what's missing and what you'll need to upgrade from vendors before proceeding (if anything).

 

But keep in mind that a D7 app was targeting Win XP. Windows is four major releases beyond that, and lots of things have been deprecated if not eliminated. A lot things might not work as expected. Pay close attention to compiler hints and warnings.

Share this post


Link to post
8 hours ago, David Schwartz said:

But keep in mind that a D7 app was targeting Win XP. Windows is four major releases beyond that, and lots of things have been deprecated if not eliminated

Besides requirement of commandline to be modifiable in CreateProcess, I don't remember any significant breaking changes unless an app uses bad practice hacks like hardcoded system folders, running always as admin and so on. x64 could require transition to SetWindowLong. I'm not dealing much with advanced UI though, maybe more changes happened in that area

Share this post


Link to post
12 hours ago, Fr0sT.Brutal said:

x64 could require transition to SetWindowLong.

I think you meant SetWindowLongPtr() instead.

Share this post


Link to post
On 7/18/2023 at 10:56 PM, David Schwartz said:

First I'd try upgrading it to D2010. Get it working there with Unicode characters and deal with other problems that may arise. 

Nah, I'd go all the way to the latest. Multiple stepping stones is just adding extra complexity. The big change is Unicode. Everything else is simple. 

Share this post


Link to post
13 hours ago, David Heffernan said:

The big change is Unicode. Everything else is simple. 

That's why David suggested starting with D2010, I suppose. IIRC it had no significant changes compared to first Unicode D2009 but was, according to my personal impression, more stable.

Edited by Fr0sT.Brutal

Share this post


Link to post
On 7/21/2023 at 12:06 AM, Fr0sT.Brutal said:

That's why David suggested starting with D2010, I suppose. IIRC it had no significant changes compared to first Unicode D2009 but was, according to my personal impression, more stable.

I had a lot of problems with D2009, so I stuck with D2007 until D2010 came out. But D2010 was also where they introduced generics, so it bridges two major inflection points in the language. 

Share this post


Link to post

Generics in 2010 were super bugged but generics is irrelevant for a port. Trying to find versions of all libraries that work with 2010 could be tricky. I see no reason in doing multiple ports here. 

Share this post


Link to post

I would also recommend doing it in one step to the most recent version. Just make sure to disable all new features like VCL Styles or High DPI support (which is enabled by default). Using the IDE in highdpi:unaware mode may also simplify ones life in case one has a high dpi system for development.

  • Like 2

Share this post


Link to post

Components may be a barrier to doing the complete transition in one step. In particular, there is no release version of DevExpress which supports both D2007 and the latest compilers. If DevExpress is an issue, then it may be best to update to the last version which supports D2007 and do the conversion of grids and other components which were removed later. The recent versions do not offer dxGrid, for example, but require changing to the cxGrid, which may be a good deal of work, depending mainly on event handlers used, as the architecture changed between dxGrid and cxGrid.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×