What Is a .vrc file, how is is generated and can you remove it using the IDE?

Bill picture Bill · Oct 25, 2013 · Viewed 14k times · Source

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:

  1. What is a vrc file?
  2. How is it produced?
  3. 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.

Answer

F.D.Castel picture F.D.Castel · Nov 16, 2014

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.