LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

_TARGET_PRODUCT_VERSION_ and _TARGET_FILE_VERSION_ bug

Solved!
Go to solution

CVI 2010 has two new predefined macros: _TARGET_PRODUCT_VERSION_ and _TARGET_FILE_VERSION_

From CVI help:

  • _TARGET_FILE_VERSION_ is defined as the value in the File Version option of the Version Info dialog box. This macro does not include increment symbols; for example, if the version string in the Version Info dialog box is 1.0.0.0+, this macro is defined to 1.0.0.0.
  • _TARGET_PRODUCT_VERSION_ is defined as the value in the Product Version option of the Version Info dialog box. This macro does not include increment symbols; for example, if the version string in the Version Info dialog box is 1.0.0.0+, this macro is defined to 1.0.0.0.

 

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:

  1. in Version Info window specify a file and a product version with auto-increment fields (for example 0.9.0.0+)
  2. every time you rebuild a release configuration you can see that the .exe file version increments as expected (right clicking on the file in Windows Explorer)
  3. but if you use _TARGET_PRODUCT_VERSION_ and/or _TARGET_FILE_VERSION_ macro to show these values on the front panel (calling SetCtrlVal(panel, PANEL_TXT, _TARGET_PRODUCT_VERSION_);) you see that this control has the same text in every build. The shown version is the first one entered in the Version Info window, but now in this window the version has the right updated value.

I think this is a bug. Am I right?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 3
(3,845 Views)
Solution
Accepted by topic author vix

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

Message 2 of 3
(3,835 Views)

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_

 

 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 3
(3,823 Views)