diff --git a/application/DebugViewpp/UpdateBuildNr.cmd b/application/DebugViewpp/UpdateBuildNr.cmd
index 7efbeadb..f77673c5 100644
--- a/application/DebugViewpp/UpdateBuildNr.cmd
+++ b/application/DebugViewpp/UpdateBuildNr.cmd
@@ -1,4 +1,8 @@
@echo off
+
+echo UpdateBuildNr.cmd updating %1
+echo UpdateBuildNr.cmd updating %2
+
set file=%1
set xmlfile=%2
for /f "tokens=3,4,5,* delims=, " %%i in (%file%) do (
diff --git a/application/DebugViewpp/version.h b/application/DebugViewpp/version.h
index 2af4bbb4..f973b927 100644
--- a/application/DebugViewpp/version.h
+++ b/application/DebugViewpp/version.h
@@ -1,2 +1,2 @@
-#define VERSION 1,9,0,0
-#define VERSION_STR "1.9.0.0"
+#define VERSION 1,9,0,24
+#define VERSION_STR "1.9.0.24"
diff --git a/application/DebugViewpp/version.wxi b/application/DebugViewpp/version.wxi
index abe2e1b8..f719b7c1 100644
--- a/application/DebugViewpp/version.wxi
+++ b/application/DebugViewpp/version.wxi
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/cmake/CMakeLists.buildnumber.cmake b/cmake/CMakeLists.buildnumber.cmake
index 4dc78908..d4f44615 100644
--- a/cmake/CMakeLists.buildnumber.cmake
+++ b/cmake/CMakeLists.buildnumber.cmake
@@ -1,17 +1,23 @@
-# Set the initial build number
-set(BUILD_NUMBER 0)
-# Check if the build number file exists
-if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/build_number.txt)
- # If it exists, read the current build number from the file
- file(READ ${CMAKE_SOURCE_DIR}/cmake/build_number.txt BUILD_NUMBER)
-endif()
+execute_process(
+ COMMAND cmd /C UpdateBuildNr.cmd version.h version.wxi
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Application/DebugviewPP/"
+ COMMAND_ERROR_IS_FATAL ANY
+)
+
+file(READ "${CMAKE_SOURCE_DIR}/application/DebugViewpp/version.h" VERSION_FILE_CONTENTS)
-# Increment the build number
-math(EXPR BUILD_NUMBER "${BUILD_NUMBER} + 1")
+# Regular expression to extract VERSION_STR
+string(REGEX MATCH "#define VERSION_STR \"([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\"" VERSION_STR_MATCH "${VERSION_FILE_CONTENTS}")
-# Write the updated build number to the file
-file(WRITE ${CMAKE_SOURCE_DIR}/cmake/build_number.txt ${BUILD_NUMBER})
+# Extract the version string from the matched content
+if(VERSION_STR_MATCH)
+ set(VERSION_STR ${CMAKE_MATCH_1})
+else()
+ message(FATAL_ERROR "Failed to extract VERSION_STR from version.h")
+endif()
# Set the build number as a CMake variable
-set(DEBUGVIEW_VERSION "1.9.0.${BUILD_NUMBER}" CACHE INTERNAL "")
+set(DEBUGVIEW_VERSION "${VERSION_STR}" CACHE INTERNAL "")
+
+MESSAGE("Retrieved version: ${VERSION_STR} from version.h")
\ No newline at end of file