When I open a Delphi 7 Project in Delphi XE2 and open the Project Option I get an error:
"Unable to set Icon: Cannot open file "........\AppName_Icon.ico".
The system cannot find the file specified".
I also notice that the Version info of the Project is missing.
The Delphi 7 project has .Res file that has the MAINICON along with the version information stored.
Why is Delphi XE2 not able to use this .Res file to retrive the MAINICON & Version information.
Also if I try to compile the application in XE2 I get an error -
[BRCC32 Error] MtxReq.vrc(2): file not found: MtxReq_Icon.ico
The MTXReq.vrc file (a new file) is created and the MtxReq.res file is deleted.
Why is this happening? I don't want to loose my project icon and version settings from .res file.
Is there a way to force XE2 to use the .res file and not delete it?
Any help will be greatly appreciated.
Sorry I can't post a comment yet (need more repotation points) ...
Warren - here the reponse to your question (Wouldn't just deleting your .dproj file and keeping the .dpr only, have been faster?)
I deleted the .dproj, .dproj.local
Opened the .dpr in XE2 and it recreated the .dproj file.
It brough back the icon from the .res but I lost project version info. Only File Version and Product Version info got migrated but lost all other versioning info. (This is because of the default manifest file).
I then tried what I explained in Step 1 of my solution.
I open the .dproj file in notepad deleted the tag entries under and reopened the .dproj file and all my version info now was recovered. The problem here is the $(BDS)\bin\default_app.manifest.
Also I noticed that Version info is stored in tag under the tag in the .dproj file and once you delete the default manifest entries, the IDE pickups the version key information correctly from the .
So basically by deleting the .dpr file I skipped the step of extracting and adding the .ico file to the project, but had to edit the newly created .proj file and delete the entries for default manifest to retrieve the version info. (another solution would have been to manully add the version info and saving the project. I did not try this)
Update 2015: Remy's idea of recreating .DPROJ files carefully by hand, is excellent advice and should be considered first, even though my answer is marked accepted.
Delphi versions prior to XE2 used resource files as an INPUT and an OUTPUT in the compilation process. For example, your delphi 7 project icon is embedded in that .res file, which you "want delphi xe2 to use", however, that's problematic in delphi 7, and now flat out impossible in XE2. Instead you now treat the .res file as a pure output artifact, the same as executable files. Don't bother checking .res files into version control any more, and don't try to pretend that the .res file is the place where you permanently store your icons. It's an output file produced automatically by the compiler, as it always should have been.
If you are a modern developer, the old way Delphi 7 worked might have annoyed you (it sure annoyed me) because you have the interesting and unsolveable question about what to do for version control: Do you check in the .RES file, or don't you? There were drawbacks to both approaches, and the fact that .RES files are now output artifacts only in XE2 is for the best. So learn to live with that.
Now that XE2 supports icons not only for a PC but also for a Mac, it must handle things differently, and they have cleaned this up. This is the origin of the problem you're seeing with the .ICO file. I have seen exactly the same error, and I have ignored it, and simply added the icon back to the project after it has otherwise been converted.
Converting a delphi 7 project (.dpr and .cfg) to Delphi XE2 is not as big a problem as the conversions between various levels of .dproj files -- each version starting with Delphi 2005,2007,2009,2010, and onwards has implemented changes in the dproj format. When problems occur with converting these projects, I do not do as Remy suggests, because it's a waste of time. What I do is DELETE the DPROJ and let it convert up from a .dpr file only.
But Remy's advice to start from scratch has many advantages, including that you may simplify your project layout.
Anyways, here's what you do:
Ignore error.
Add icon to project yourself.
Continue merrily along, and don't worry about the deletion of the .res file, that's intentional, and for good reasons. A new one will be created whenever needed. The filename of the .ico file on disk will be read by using the contents of the XE2 .dproj file and compiled into the .res file, as it should be.
As is always the case, you should NEVER let the IDE convert a project from an older version to the newer version. The conversion RARELY works correctly. You should ALWAYS create a new project in the newer IDE and then add your existing source files to it as needed.
Thanks everyone for your inputs and suggestions.
After I submitted my posting, I tried these steps to resolve the .ico issue and the missing Version issue/version info carry over issues :
Step 1. Edited the .dProj file and removed the reference to default_app.manifest related entries under tag (My project platform is 32 bit)
I deleted all tags under this except tag related to namespace System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
Without this my application was always showing the version info as 1.0.0.0 and ignoring everything else that I had specified.
(I am not sure if this is a right step but it solved my version info issue. There may be a simpler/another solution for this...)
Step 2. Extracted the ico from the old .res file, named it and added that .ico file to the Project from the Project Options.
the physical .ico file is the the projects folder and will be checked in source control (VSS in my case).
These two steps bought me to what I needed and then I can modify the Version number and compile the project.
From this point on there are no issues.
These were much simpler than the total conversion/migration I had to do for my applications from D7 to XE2 - Unicode conversion, migrating customized Raize 5 componets to Raize 6, Turbo Power, Virtual Tree View, Hypergrid etc. etc. etc... Luckily I found XE2 versions of all these components.
Related
I need to open a project written in Delphi XE4, but I have only Delphi 2007. When i try to open the project, I get this error:
Only one top level element is allowed in an XML document
I know the error is due to the project is wrote in a newer Delphi version. Is there any trick i could use to open it in an old version ?
An XML document is required to have exactly on root element. The error is informing you that your document does not adhere to that rule and is thus malformed. That seems a little odd because no version of Delphi writes out such malformed .dproj files. Perhaps the .dproj file has been corrupted in some way.
The most expedient way to get around this issue is to remove the .dproj file and let the IDE regenerate one. From there you may need to apply settings that were previously set in the XE4 .dproj file, but you should at least be able to get started.
It happened to me, as I downloded RealThinClient and first installed in my Delphi 11 and possibly I had saved it with Delhpi 11.
Later I tried to install it in Delphi 2007 and I encountered error. All I have to do was to delete dproj files and open dpk files and all went fine.
Later I found that older Delphi uses 2 spaces for indent in XML data while newer version use 4 spaces, thus old version wrongly interprates XML data if 4 spaces are used as indent.
Every time I run the .dproj file in xe5, I get an error "Exception EReadError in module StartCoatPro.exe at 000C0304. Error reading LineSeries1.Legend.Visible: Property Legend.Visible does not exist."
I tried looking for the Legend.Visible property under LineSeries1 in the .dfm file but I couldn't find it. Then I also tried to put a line, Legend.Visible = True, but doesn't seem to work too. Please help.
Thanks!
Project files are version-specific. You cannot edit an XE6 project in the XE5 IDE and vice versa, for instance.
But what you are experiencing is not a project problem, it is a DFM problem. You have an XE6 DFM that contains a value for a property that apparently does not exist in XE5. Do not try to edit DFM files across version boundaries, either. Newer versions tend to store new properties that cause errors in earlier versions.
Cross-version project management is tricky. Best not to share version-specific files at all, unless you use third-party tools to help you. For instance, there are tools available that manipulate DFMs to strip out newer properties when downgrading to an older IDE.
In C++Builder XE5.
My understanding is that the binary file MyProject.res (which is created by the compiler in the same directory as the .cbproj file) contains compiled versions of the program icon and the project version details (although mine also seems to contain an XML manifest).
But this info is also contained in the .cbproj file and the .ico files; and if I delete the .res file then it seems to get recreated exactly was it was next time I open the project.
So is it safe to mark *.res as not being in source control? (I use git). And/Or is it possible to have it generated in the same directory as the object files instead, so it's not mixed in with the source?
(This certainly wasn't safe in C++Builder 5 - if you deleted the .res file then it complained it couldn't find it, and you lost your icons).
Update: Does this also apply to the .tlb file? This seems to be compiled based on the .ridl file, and if I delete it then it is automatically regenerated.
C++ Builder 6.0 and later will recreate RES files if deleted. I treat them as other temporary/build files (like OBJ files) and do not put them in version control software. I do have nightly backups that include all of these files though, which I think is still good practice.
I am not sure about TLB files. I would temporarily delete (aka-rename) one and see if it gets recreated to the same state. If so, should be same as RES files.
This does not hold true for 3rd party libraries though, if all you have is compiled resources. In that case, I still do not place in my version control though, since I am not going to be modifying them. I just have my backups.
For what it's worth, the TFS source control defaults are to exclude *.res but include *.tlb.
So you should expect *.res files to be created by their associated builds. If the build isn't going to be present, then the *.res file should be included.
I suspect that you're right about *.tlb files being built as well, but perhaps TFS doesn't exclude these on default because the extension isn't entirely unique to OLE type library files alone.
I am trying to install a commercial component called JamShellBrowser but it will not install.
I have contacted the developer, but meanwhile I'd like to know:
What is a vrc file?
How is it produced?
Can it be controlled or modified with the Delphi XE4 IDE?
I checked the IDE's help but I could not find anything about vrc files and I searched for Delphi vrc and did not find anything that would help me.
The error message is:
Checking project dependencies...
Compiling JamShellDelphiXE4.dproj (Release, Win32)
brcc32 command line for "JamShellDelphiXE4.vrc"
c:\program files (x86)\embarcadero\rad studio\11.0\bin\cgrc.exe -c65001 JamShellDelphiXE4.vrc -foJamShellDelphiXE4.res
[BRCC32 Error] JamShellDelphiXE4.vrc(2): file not found: JamShellDelphiXE2_Icon.ico
Failed
Elapsed time: 00:00:00.1
I searched the components folders for an ico file, but there is none... thus the message, but even if I remove the line MAINICON ICON "JamShellDelphiXE2_Icon.ico" from the vrc file or even delete the vrc file it is automatically generated when I try to install.
I moved from Delphi 2010 to XE4 a few months ago and noticed the apparently new vrc file but I do not know what it is or how to handle these files.
A .vrc is a temporary file created by Delphi MSBuild process to compile resources files (.res) which will be linked in the final binary output. It is passed to CodeGear Resource Compiler/Binder (cgrc.exe) and deleted after the build process.
It doesn't appear anywhere in .dproj file. This behaviour is from BuildVersionResource target, imported from $(BDS)\Bin\CodeGear.Common.Targets. Look at this file (and at CodeGear.Delphi.Targets) if you want to get a better understanding of build process.
Removing <Icon_MainIcon> tag from .dproj it's not enough, as VERSIONINFO resources can also force the creation of .vrc file (I believe "vrc" stands for "Version Resource", although it is also used for main icon in applications).
In case of packages, Delphi always put version info in packages projects. The "include version information" IDE option is ignored with package projects.
So, if you (like me)
don't rely on Delphi IDE to set application main icon
don't rely on Delphi IDE to set version info resources; and
do manage to include your own resources files for everything
you can disable its creation entirely by setting the SkipResGeneration to true in your msbuild call. E.g.:
msbuild.exe myProject /t:Build /p:Config=Release /p:SkipResGeneration=true
However, this only works for MSBuild-based builds. I don't know how to do the same for builds from Delphi IDE.
Just open your #PROJECT#.dproj in any text editor file and find lines
<Icon_MainIcon>#PROJECT#_Icon.ico</Icon_MainIcon>
and delete them.
You will find one per Build target.
Save the file and you are done.
Edit: The original answer referred to the .dpr file, however note the section to edit is in the .dproj hence I've updated the the answer above to reflect this.
I believe this is a built in IDE behaviour of Delphi XE4 and XE5, possibly caused by an upgrade bug. Generation of VRC files is something that you can not disable except by removing the tags in the dproj file that cause it to be generated.
If there was a way to fix it or remove it, it might involve comparing your dproj file with another dproj file and looking for something that was appropriate only to a .dpr+.dproj Project that somehow got into your .dpk+.dproj project, like <Icon_MainIcon>.
It appears to be an intermediate file that is auto-generated when a .dpr+.dproj project has some version information which must be written out of the .dproj file, and into a temporary location and then compiled and linked into your application as a version info resource. However, I have also seen it get generated for a .dpk+.dproj project, and this mystifies me as well.
It also seems to contain a resource for your default application icon and version information, and packages do not normally have a versioninfo or application icon resource.
What I find to be possibly a BUG is that there is no UI in the Delphi IDE to let you set the Application Icon of a Package. Yet, I sometimes get a .VRC and an .ICO file. But I am not aware of a fix, other than to report the issue to Embarcadero Quality Central.
With a .dproj project, a .VRC intermediate file makes at least some sense. I see the following content: Version Info, Application Icon, and VCL Styles (ie AquaLightSlate.vsf) resource linkage.
this is a clarification...
I've just started to install several component libraries into Delphi RAD Studio XE5 that I've got installed in XE2 and XE4. When I try to Build most of them, I get this same error.
The problem isn't so much the .vrc file itself, it's this particular error:
[BRCC32 Error] <project_name>.vrc(2): file not found: <project_name>_Icon.ico
I can't figure out a way to bypass it, and I have no idea what it's looking for or where.
I tend to copy my component libs from one version to the next, opening them, building them, and installing them (ie. the ones that don't come with installers). I've never seen this happen in prior versions. However, this is the first time I've had RAD Studio installed; in the past I've just had Delphi. So perhaps it has something to do with having C++ installed as well?
I had to change my X.optset file to get this to work.
X being the name of your Delphi version you brought over these options from. Mine was PolyDelphiXE2.optset.
Once I corrected the name here no more funny compiling that brought in a different ico reference.
Delphi is a great IDE and compiler. But sometimes it also has a few minor flaws. Like my problem right now...
I am working on a project that's created in Delphi 2007. But I like to use Delphi XE simply because the IDE has some interesting features and it happens to be more stable on my computer. So I opened the project in Delphi XE and have been changing the code, with backwards-compatibility in mind.
When I save the project again to open it in D2007, it has problems reading the project, though. The dproj file of XE is not compatible with 2007. To open the project in D2007 again, I need to delete the dproj file and open the dpr file. (Or I need to save the old proj file of 2007 and put it back again when I want to use D2007 again.)
This is annoying. Does anyone know a better solution to keep the right dproj file for each version?
One thing you could do would be to place the DPR and DPROJ files in separate directories. Unfortunately you would have to merge any changes you make in one version to the other, but that is fairly simple using Beyond compare:
BCompare.exe .\d2007\project.dpr .\dXE\project.dpr
You can have your project in version control like Subversion. If you omit the .dproj files from version control, it is usually quite manageable to work in different versions of Delphi
I'm using single .dpr and multiple .dproj files in such case.
Basic steps:
- Create project in D2007.
- Close project.
- Copy project.dproj to project.xe.dproj.
- Open project.xe.dproj in XE.
- Let it upgrade the project, save it and overwrite old project.xe.dproj.
- Delete backup copy of project.xe.dproj created during the upgrade.
Now you have project.dproj to use in D2007 and project.xe.dproj to use in XE. Both are using the same codebase - project.dpr.