15

By default, the file extension descriptions for .DPR and .DPROJ are the same, so in Explorer when opening a project file with the same base name, both file descriptions are listed as "Delphi Project File" This presents a choice to the developer - which file to open?

I typically open the second file listed, assuming it's the DPROJ.

Are there any downsides of opening a DPR when there is a corresponding DPROJ file on file? Does the IDE handle this gracefully?

I sometimes open the first file listed and I haven't noticed any problems, but it's one of those curiosities remaining unanswered. I looked through the help and couldn't find anything.

Darian Miller
  • 7,808
  • 3
  • 43
  • 62
  • 5
    There doesn't _seem_ to be any functional difference... – 500 - Internal Server Error Dec 05 '12 at 23:21
  • 6
    It's time to change your explorer settings. Hide extensions for know file types needs to be switched off. – David Heffernan Dec 06 '12 at 07:32
  • 5
    Unchecking "Hide extensions for know file types" in folder options is one of the first things to do after fresh Windows installation. – kludg Dec 06 '12 at 10:45
  • 4
    David/Serg - one of the first things I do on every windows install is to uncheck that 'Hide file extensions for known types' option. (And then add file paths in title bar, show hidden files) But typically you have to enlarge the filename column to see the extension if it's a project filename with any real length. – Darian Miller Dec 06 '12 at 15:25
  • http://codeverge.com/embarcadero.delphi.ide/dpr-vs-dproj/1049502 – Palec Feb 29 '16 at 17:37
  • Also see: https://www.uweraabe.de/Blog/2017/01/18/dproj-changed-or-not-changed/ – Gabriel Aug 30 '19 at 11:52

2 Answers2

29

A *.dpr file contains delphi source and *.dproj contains the project configuration.

Opening one of them the IDE is looking for the other automatically.

Try to remove the *.dproj file and open the (remaining) *.dpr the IDE will inform you, that a new *.dproj file will be generated.

Do not try to remove the *.dpr :o)

Sir Rufo
  • 18,395
  • 2
  • 39
  • 73
6

It can be convenient if you use older Delphi versions as well. For instance, you can open dpr with Delphi 7 and open dproj with the latest version. It allows you to open both old and new projects with a double click from the Windows Explorer.

Dproj files are MSBuild compatible files, which is used to compile the projects with.

The Delphi IDE itself doesn't actually need them to open the project. The dproj file does contain settings and the version number, though, which were stored in the dof file in Delphi 2006 and before. If the dproj file cannot be found, it is regenerated with default settings, whereas the dpr is required and is not regenerated. It's not possible, since it not only contains the uses-list, but also actual initialization code for your application.

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • 2
    It IS needed if you want your project settings including compiler defines, and project search path to be kept. :-) Delete it and everything's back to Delphi 7 level. The IDE loads them, as does the MSBUILD. The IDE adds several private areas to the .dproj file which are the new place where what used to be stored in `.dof` files goes now. So this is not right. -1 for misinformation. – Warren P Dec 06 '12 at 00:23
  • 4
    .dproj is a sad little mashup though, and version controlling it can be troublesome. – Warren P Dec 06 '12 at 00:26
  • 1
    You guys are right about the dof file. Apparently I haven't been paying attention lately. I usually don't customize the project settings, so apart from the version number being reset, I've never really noticed any issues with deleting `dproj` files. But indeed it stores more than just the version information, so I've altered that description. My humblest apologies for the misinformation. – GolezTrol Dec 06 '12 at 00:38
  • @WeGoToMars Thanks! It seems to be replaced by https://www.uweraabe.de/Blog/2018/05/17/keep-your-project-files-clean-with-project-magician/ but that certainly looks promising! – GolezTrol Aug 30 '19 at 15:01