Resource Compiler

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Resource Compiler

Post by ecos »

Hi all,
in VO we could do something like

DEFINE MAINVERSION := "4"
DEFINE SUBVERSION := "0"
DEFINE MAINBUILD := "21"
DEFINE SUBBUILD := "12"

RESOURCE VS_VERSION_INFO VERSIONINFO
FILEVERSION MAINVERSION,SUBVERSION,MAINBUILD,SUBBUILD
......

The transporter replaces the defines in the resource with their actual values.
Is it still possible to use defines in resources or does anybody know a trick how to achieve this ?

TIA
Karl
ic2
Posts: 1865
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Resource Compiler

Post by ic2 »

Hello Karl,

While Chris/Robert could no doubt explain why the Transporter replace values, we have a Defines.vh included in an X# program containing code like this:

#define CLM_RESOURCES 11326

So I'd say it is still possible like in VO (with a # before the define apparently).

Dick
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Resource Compiler

Post by ecos »

Hello Dick,

I always get

Fehler RC2104 undefined keyword or key name: MAINVERSION 12-proMOTM D:ProjekteproMO12-proMOTM___Version___.VS_VERSION_INFO.rc 2

no matter how I define MAINVERSION.

#define inside the rc-file seems to work, but I can't refer to defines elsewhere in the application...
Maybe the only solution for this will be include-files so that all rc-files in a solution can use the same defines..
User avatar
robert
Posts: 4567
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Resource Compiler

Post by robert »

Karl,
It is better that you do not add a version info resource to your DLL/EXE at all and use these defines in Assembly attributes. The compiler will then automatically generate the version resource for you.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4986
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Resource Compiler

Post by Chris »

Hi Karl,

As Robert said, in .Net it is better to use version Assembly attributes for that. But if you insist to use a native resource, then the defines must be entered in the way the resource compiler (rc.exe) expects them:

#define MAINVERSION 4
#define SUBVERSION 0
#define MAINBUILD 21
#define SUBBUILD 12

Also you must not include the word RESOURCE in the .rc file, this is not recognised by the resource compiler, it is only used in VO to define the resource "entity"

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Resource Compiler

Post by ecos »

Thanks for the hint, I think I can see what you mean in the ReportPro-source. I'll change my source accordingly

Karl
Post Reply