如何在.rc文件中使用配置(宏)值(vs2010 ro vs2013)?

时间:2021-08-18 19:27:10

I want to use some configuration(macro) variables, e.g. $(Configuration) in my .rc file. For example I want to have something like this in my .rc file.

我想使用一些配置(宏)变量,例如我的.rc文件中的$(配置)。例如,我想在我的.rc文件中有这样的东西。

....
....
VALUE "InternalName", "MyProjectName $(Configuration)"
....
....

But, the result, when I see my projects output's properties, is <> rather than <> as I expected!

但是,当我看到我的项目输出属性时,结果是<>而不是<>,正如我预期的那样!

Is it possible? Note: I need to have different values in different configurations. For example I want to have different application name (that will come in my application properties) in Debug and Release mode.

可能吗?注意:我需要在不同的配置中使用不同的值。例如,我希望在调试和发布模式下具有不同的应用程序名称(将在我的应用程序属性中出现)。

1 个解决方案

#1


Define a macro at Resource compiler commandline.

在资源编译器命令行定义宏。

Project properties -> Resources -> General -> "Preprocessor Defines"

项目属性 - >资源 - >常规 - >“预处理器定义”

CONFIGURATION=$(Configuration);

Use in RC and remember to stringize if used as string.

在RC中使用并记住如果用作字符串则进行字符串化。

#define _STRINGIZE(x) #x
#define STRINGIZE(x) _STRINGIZE(x)

VALUE "InternalName", "MyProjectName " STRINGIZE(CONFIGURATION)

#1


Define a macro at Resource compiler commandline.

在资源编译器命令行定义宏。

Project properties -> Resources -> General -> "Preprocessor Defines"

项目属性 - >资源 - >常规 - >“预处理器定义”

CONFIGURATION=$(Configuration);

Use in RC and remember to stringize if used as string.

在RC中使用并记住如果用作字符串则进行字符串化。

#define _STRINGIZE(x) #x
#define STRINGIZE(x) _STRINGIZE(x)

VALUE "InternalName", "MyProjectName " STRINGIZE(CONFIGURATION)