Delphi 7 - problem with Delphi XE2.res

When I open a Delphi 7 project in Delphi XE2 and open the Project option, I get an error message:

"Unable to set Icon: Cannot open file "........\AppName_Icon.ico". The system cannot find the file specified". 

I also noticed that project version information is missing. The Delphi 7 project has a .Res file with MAINICON along with saved version information. Why can't Delphi XE2 use this .Res file to retrieve MAINICON and version information.

Also, if I try to compile the application in XE2, I get an error message -

 [BRCC32 Error] MtxReq.vrc(2): file not found: MtxReq_Icon.ico 

The MTXReq.vrc file (new file) is created and the MtxReq.res file is deleted.

Why is this happening? I do not want to lose the project settings and parameters in the .res file.

Is there a way to get XE2 to use the .res file rather than deleting it?

Any help would be greatly appreciated.


Sorry, I can’t leave comments yet (need more repo points) ...

Warren is the answer to your question (wouldn’t it just delete your .dproj file and save only .dpr?)

I deleted .dproj, .dproj.local. I opened .dpr in XE2 and recreated the .dproj file. This will return the icon from .res, but I lost the project version information. Only the version information of the file and the version of the product was transferred, but any other version information was lost. (This is because of the default manifest file). Then I tried what I explained in step 1 of my solution. I open the .dproj file in notepad, which removes the tags and closes the .dproj file, and all information about my version is now restored. The problem here is $ (BDS) \ bin \ default_app.manifest. I also noticed that version information is stored in the tag under the tag in the .dproj file, and after deleting the manifest entries by default, the IDE correctly reads the version key information.

So basically, by deleting the .dpr file, I skipped the step of extracting and adding the .ico file to the project, but I had to edit the newly created .proj file and delete the entries for the default manifest to get version information. (another solution would be for manully to add version information and save the project. I have not tried this)

+6
source share
3 answers

Update 2015 . The idea of ​​recreating .DPROJ files carefully by hand is excellent advice and should be considered the first, although my answer is marked as recognized.

Versions of Delphi prior to XE2 used resource files like INPUT and OUTPUT during compilation. For example, your delphi 7 project icon is embedded in this .res file that you want to use delphi xe2, however, this is a problem in delphi 7, and now this is not possible in XE2. Instead, you now treat the .res file as a pure output artifact, like executable files. Don't worry, check your .res files in version control and don't try to pretend that a .res file is where you keep your icons permanently. This is an output file created automatically by the compiler, as it always should have been.

If you are a modern developer, the old way of working with Delphi 7 can annoy you (it annoyed me), because you have an interesting and insoluble question about what to do for version control: are you checking the .RES file or not? There were drawbacks to both approaches, and the fact that .RES files now only display artifacts in XE2. So learn to live with it.

Now that XE2 supports icons not only for PCs, but also for Macs, it has to handle things differently, and they cleaned it up. This is the source of the problem you see with the .ICO file. I saw exactly the same error, and I ignored it, and simply added the icon back to the project after converting it.

Converting a Delphi 7 project (.dpr and .cfg) to Delphi XE2 is not such a big problem as converting between different levels of .dproj files - each version, starting with Delphi 2005,2007,2009,2010 and onward, introduced changes in the dproj format. When problems arise with the conversion of these projects, I don’t do as Remy suggests, because it is a waste of time. What I'm doing is REMOVING DPROJ and allow converting it from the .dpr file.
But Remy's recommendations to start from scratch have many advantages, including that you can simplify the layout of your project.

Anyway, here's what you do:

  • Ignore the error.
  • Add an icon to project yourself.
  • Keep up the fun and don't worry about deleting the .res file, which is intentional and for good reason. If necessary, a new one will be created. The name of the .ico file on the disk will be calculated using the contents of the XE2.dproj file and compiled into the .res file, as it should be.
+12
source

As always, you should NEVER let the IDE convert a project from an old version to a newer version. RARELY conversion is working correctly. You should ALWAYS create a new project in the new IDE, and then add existing source files to it if necessary.

+3
source

Thank you all for your materials and suggestions.

After I sent the message, I tried these steps to solve the .ico problem and the missing version / version problem:

Step 1 I edited the .dProj file and deleted the link to the default_app.manifest related entries in the tag (my project platform is 32 bits) I deleted all the tags with this exception, except for the tag associated with the System.Win namespace; Data.Win; Datasnap.Win; Web.Win; Soap.Win; Xml.Win; Bde; $ (DCC_Namespace)

Without this, my application always showed version information as 1.0.0.0 and ignored everything else that I specified.

(I'm not sure if this is the right step, but he solved the problem with version information. There may be a simpler / different solution for this ...)

Step 2. Extracted ico from the old .res file, named it, and added this .ico file to the project from the project settings. The physical .ico file is the project folder and will be checked in the control source (VSS in my case).

These two steps bought me to what I needed, and then I can change the version number and compile the project. From this moment there are no problems.

It was much easier than the general conversion / migration that I had to do for my applications from D7 to XE2 - Unicode conversion, porting customized Raize 5 components to Raize 6, Turbo Power, Virtual Tree View, Hypergrid, etc. etc ... Fortunately, I found XE2 versions of all these components.

+1
source

Source: https://habr.com/ru/post/922601/


All Articles