07-21-2011 07:36 AM
CVI 2010 has two new predefined macros: _TARGET_PRODUCT_VERSION_ and _TARGET_FILE_VERSION_
From CVI help:
LabWindows/CVI auto-increments fields in which you add a + character. For example, if you specify 1.0+.0.0+, the next version string is 1.0.0.0, and LabWindows/CVI increments the version string to 1.1+.0.1+. LabWindows/CVI increments fields only for successful builds of a Release configuration.You can access the File Version and Product Version values programatically using the _TARGET_FILE_VERSION_ and _TARGET_PRODUCT_VERSION_ predefined macros.
I found that these macros don't work, and it's quite easy to reproduce this issue:
I think this is a bug. Am I right?
Solved! Go to Solution.
07-21-2011 02:13 PM
What is probably happening is that the file in which you are using those macros hasn't been recompiled since your previous release builds. If you mark your project for compilation (Build>>Mark Project for Compilation) do you notice the values of the macros changing?
One thing you need to be aware of is that the act of building with auto-increment enabled doesn't automatically trigger a full rebuild of your entire project.
This is obviously not ideal, since any code that you have that uses those macros might not be recompiled on your next build. However, the alternative would also be problematic: since the compiler currently has no way of knowing which source files include references to these macros, CVI would have to mark all files in your project for recompilation following each build with auto-increment. Which would mean that every release build would always be a full build.
Luis
07-22-2011 09:57 AM
It is exactly how you wrote in your message.
I think that this behavior is the best choice, but I suggest that the documentation for these macros should be modified adding a warning like the following one:
WARNING!
_TARGET_PRODUCT_VERSION_ and _TARGET_FILE_VERSION_ values are updated only when the file that contains them is recompiled.
So be sure to include them only in files that are recompiled at every build.
A better solution would be to have ad additional macro that forces the recompilation of the file that calls it. It would be useful in the files that call _TARGET_PRODUCT_VERSION_ or _TARGET_FILE_VERSION_