diff --git a/.gitignore b/.gitignore
index 696b3cae..1528c6e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ config.h
config.log
config.status
config.sub
+config-win32.h
configure
configure.tmp
depcomp
@@ -45,6 +46,7 @@ src/common/make-te
src/common/textenums.h
src/common/textevents.h
src/fe-gtk/hexchat
+src/fe-gtk/hexchat.rc
src/fe-text/hexchat-text
src/htm/Main.resources
src/htm/thememan.exe
@@ -70,6 +72,7 @@ win32/ext/perl/perl-x86-cache
win32/ext/perl/perl-x86-SetupFiles
win32/ext/perl/perl-x64-cache
win32/ext/perl/perl-x64-SetupFiles
+win32/installer/hexchat.iss
resource.h
*.opensdf
*.sdf
diff --git a/config-win32.h b/config-win32.h.tt
similarity index 63%
rename from config-win32.h
rename to config-win32.h.tt
index 9c7a1a1d..8f21d0b1 100644
--- a/config-win32.h
+++ b/config-win32.h.tt
@@ -1,4 +1,4 @@
-#define LOCALEDIR ".\\share\\locale"
+<#@ include file="version.include.tt" #>#define LOCALEDIR ".\\share\\locale"
#define ENABLE_NLS
#define USE_GMODULE
#define USE_PLUGIN
@@ -8,12 +8,12 @@
#define ISO_CODES_PREFIX ".\\"
#define ISO_CODES_LOCALEDIR LOCALEDIR
#define PACKAGE_NAME "hexchat"
-#define PACKAGE_VERSION "2.9.6"
+#define PACKAGE_VERSION "<#= string.Join(".", versionParts) #>"
#define HEXCHATLIBDIR ".\\plugins"
#define HEXCHATSHAREDIR "."
#define OLD_PERL
#define GETTEXT_PACKAGE "hexchat"
-#define PACKAGE_TARNAME "hexchat-2.9.6"
+#define PACKAGE_TARNAME "hexchat-<#= string.Join(".", versionParts) #>"
#ifndef USE_IPV6
#define socklen_t int
#endif
diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj
index bc2605dd..13610cee 100644
--- a/src/common/common.vcxproj
+++ b/src/common/common.vcxproj
@@ -14,7 +14,6 @@
-
@@ -75,6 +74,10 @@
+
+
+
+
{87554B59-006C-4D94-9714-897B27067BA3}
Win32Proj
@@ -151,4 +154,15 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj
index 73526766..7cc40da8 100644
--- a/src/fe-gtk/fe-gtk.vcxproj
+++ b/src/fe-gtk/fe-gtk.vcxproj
@@ -97,8 +97,14 @@
- $(DepsRoot)\bin\glib-compile-resources.exe --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
- Build gresource file
+
+
+
+ Build hexchat.rc and gresource file
@@ -166,6 +172,7 @@
+
diff --git a/src/fe-gtk/hexchat.rc b/src/fe-gtk/hexchat.rc.tt
similarity index 76%
rename from src/fe-gtk/hexchat.rc
rename to src/fe-gtk/hexchat.rc.tt
index 789aa26e..87507340 100644
--- a/src/fe-gtk/hexchat.rc
+++ b/src/fe-gtk/hexchat.rc.tt
@@ -1,6 +1,7 @@
-#include
+<#@ include file="..\..\version.include.tt" #>#include
#include "../../config-win32.h"
-#include "../../resource.h"
+
+#define COMMA_VERSION <#= string.Join(",", versionParts) #>,0
XC_ICON ICON "../../data/icons/hexchat.ico"
diff --git a/version.include.tt b/version.include.tt
new file mode 100644
index 00000000..ab77a6d9
--- /dev/null
+++ b/version.include.tt
@@ -0,0 +1,12 @@
+<#@
+ template debug="false" hostspecific="false" language="C#" #><#@
+ assembly name="System.Core" #><#@
+ import namespace="System.IO" #><#@
+ import namespace="System.Linq" #><#@
+ import namespace="System.Text.RegularExpressions" #><#
+ var versionParts = File.ReadLines(Path.Combine(System.Environment.GetEnvironmentVariable("SOLUTIONDIR"), "configure.ac"))
+ .Select(line => Regex.Match(line, @"^AC_INIT\(\[HexChat\],\[([^]]+)\]\)$"))
+ .First(match => match.Success)
+ .Groups[1].Value
+ .Split('.');
+#>
\ No newline at end of file
diff --git a/win32/installer/hexchat.iss b/win32/installer/hexchat.iss.tt
similarity index 99%
rename from win32/installer/hexchat.iss
rename to win32/installer/hexchat.iss.tt
index 68d0bedb..486e2f8d 100644
--- a/win32/installer/hexchat.iss
+++ b/win32/installer/hexchat.iss.tt
@@ -1,5 +1,5 @@
-#define APPNAM "HexChat"
-#define APPVER "2.9.6"
+<#@ include file="..\..\version.include.tt" #>#define APPNAM "HexChat"
+#define APPVER "<#= string.Join(".", versionParts) #>"
; These are defined by our installer project at build time
;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\hexchat\win32\installer\"
diff --git a/win32/installer/installer.vcxproj b/win32/installer/installer.vcxproj
index 88de2c35..453e87bd 100644
--- a/win32/installer/installer.vcxproj
+++ b/win32/installer/installer.vcxproj
@@ -62,9 +62,14 @@
+
+type hexchat.iss >> "$(OutDir)hexchat.iss"
+"$(ProgramFiles)\Inno Setup 5\iscc.exe" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
+ ]]>
+
diff --git a/win32/version.txt.tt b/win32/version.txt.tt
new file mode 100644
index 00000000..64e50010
--- /dev/null
+++ b/win32/version.txt.tt
@@ -0,0 +1 @@
+<#@ include file="..\version.include.tt" #><#= string.Join(".", versionParts) #>
\ No newline at end of file