PDA

View Full Version : Reading a value of Macro from a external file


ShiamakD
05-09-2008, 10:15 AM
Hi,

Is there a way to read a value of macro defined in a file.

i have a header file something like this
#define WIN2K_VERSION 1,0,WIN2K_BLD_ID// for FILEVERSION/PRODUCTVERSION
#define STR_PRODUCT_NAME "Test Dummy Software"// for "ProductName"
#define STR_BUILD_NUMBER "1.0.0.20080208" // for "FileVersion"/"ProductVersion" NN is being excluded for this demo
#define STR_APP_VERSION "1.0" // Test Dummy About box
#define szAppBuildNumber _T("(Build 1.0.0.20080208)") // for About dialogs
#define szAppBuildDate "2020080208"// numeric, 10-digit build ID
#define STR_COMPANY_NAME "Siemens HealthCare Diagnostics" // for "CompanyName"
#define szAppCompanyName _T( STR_COMPANY_NAME )// IDC_APP_COMPANY_NAME
#define STR_COPYRIGHT "Copyright © Siemens HealthCare Diagnostics 2008. All Rights Reserved" // for "LegalCopyright"
#define szAppCopyright _T( STR_COPYRIGHT ) // for About dialogs

Where different strings gets updated at the BUILD time, what i wanna do is create a macro in my Visual Build script then read the VALUE of macro defined/updated in my file then allocate the READ value to my visual build macro and then use it for PROPERTIES section of Make VS 2005 .


To make myself more clear , lets say STR_szAppBuildNumber in my exteral file hold the value of build number that changes everyday, now I would like to read this value of szAppBuildNumer string and allocate this value to a MACRO defined within VisualBuild script , and then use the VisualBuild macro to assing this value to CONFIGURATIOn of PROPERTIES?

Is it possible?

Also does VisualBuild allows a user to ADD additional property strings (in C# its is called assemblyAttributes).

TIA

kinook
05-09-2008, 05:04 PM
Originally posted by ShiamakD
Hi,

Is there a way to read a value of macro defined in a file.

...

Where different strings gets updated at the BUILD time, what i wanna do is create a macro in my Visual Build script then read the VALUE of macro defined/updated in my file then allocate the READ value to my visual build macro and then use it for PROPERTIES section of Make VS 2005 .

To make myself more clear , lets say STR_szAppBuildNumber in my exteral file hold the value of build number that changes everyday, now I would like to read this value of szAppBuildNumer string and allocate this value to a MACRO defined within VisualBuild script , and then use the VisualBuild macro to assing this value to CONFIGURATIOn of PROPERTIES?

Is it possible?Yes, see attached sample.

Also does VisualBuild allows a user to ADD additional property strings (in C# its is called assemblyAttributes).Yes, for each property specified on the Properties tab of the Make VS 2005 action (for managed projects), if the corresponding assembly attribute doesn't exist, it will be added to the project's assemblyinfo file. To add other attributes, use the Replace in File action (see attachment).

ShiamakD
05-12-2008, 12:56 PM
Originally posted by kinook
[B]Yes, see attached sample.

Yes, for each property specified on the Properties tab of the Make VS 2005 action (for managed projects), if the corresponding assembly attribute doesn't exist, it will be added to the project's assemblyinfo file. To add other attributes, use the Replace in File action

Hi,

I was able to sucessfully add new AssemblyName as per your instructions. however upon compiling new DLL i recieved following error

Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs
Properties\AssemblyInfo.cs(27,12): error CS0246: The type or namespace name 'AssemblyInternalBuild' could not be found (are you missing a using directive or an assembly reference?)
Done building project "WindowsApplication1.csproj" -- FAILED.

Did i miss something, why cmpiler was not able to find 'AssemblyInternalBuild' ?

TIA

kinook
05-12-2008, 01:09 PM
Apparently AssemblyInternalBuild is not a valid assembly attribute name.

ShiamakD
05-12-2008, 01:11 PM
Originally posted by kinook
Apparently AssemblyInternalBuild is not a valid assembly attribute name.

So then it looks like new assemblyAttribuributes can not be added ?

TIA

kinook
05-12-2008, 01:16 PM
http://www.codinghorror.com/blog/archives/000142.html