diff --git a/OpenBoard.pro b/OpenBoard.pro
index 50ea777adc45b08686e1379ac12ca8a66daeb012..e1bc733f3cba45c6e7ded4036a1ef30e6d975b89 100644
--- a/OpenBoard.pro
+++ b/OpenBoard.pro
@@ -91,8 +91,6 @@ UB_FONTS.files = resources/fonts
 UB_THIRDPARTY_INTERACTIVE.files = thirdparty/interactive
 
 DEFINES += NO_THIRD_PARTY_WARNINGS
-DEFINES += UBVERSION=\"\\\"$${LONG_VERSION}\"\\\" \
-   UBVERSION_RC=$$VERSION_RC
 ALPHA_BETA_STR = $$find(VERSION, "[ab]")
 count(ALPHA_BETA_STR, 1):DEFINES += PRE_RELEASE
 BUILD_DIR = build
@@ -140,6 +138,19 @@ win32 {
    DEFINES += NOMINMAX # avoids compilation error in qdatetime.h
 
 
+   # Windows doesn't support file versions with more than 4 fields, so
+   # we omit the build number (which is only used for pre-release versions
+   # anyway)
+
+   VERSION_RC = $$VERSION_MAJ,$$VERSION_MIN,$$VERSION_PATCH,$$VERSION_TYPE
+   VERSION_RC = $$replace(VERSION_RC, "a", "160") # 0xA0
+   VERSION_RC = $$replace(VERSION_RC, "b", "176") # 0xB0
+   VERSION_RC = $$replace(VERSION_RC, "rc", "192" ) # 0xC0
+   VERSION_RC = $$replace(VERSION_RC, "r", "240") # 0xF0
+
+
+   DEFINES += UBVERSION=\"\\\"$${VERSION}\"\\\" \
+        UBVERSION_RC=$$VERSION_RC
 }
 
 macx {