diff --git a/tests/mtouch/Makefile b/tests/mtouch/Makefile
index 1516e91424..2fa0938c9d 100644
--- a/tests/mtouch/Makefile
+++ b/tests/mtouch/Makefile
@@ -35,6 +35,9 @@ bin/Debug/mtouchtests.dll: $(mtouchtests_dependencies)
$(SYSTEM_XIBUILD) -- mtouchtests.csproj /r $(XBUILD_VERBOSITY) /bl
$(Q) rm -f .failed-stamp
+$(abspath $(TOP)/tools/mtouch/Constants.cs):
+ $(Q) $(MAKE) $(notdir $@) -C $(dir $@)
+
build: bin/Debug/mtouchtests.dll
test.config: $(TOP)/Make.config Makefile
diff --git a/tools/mtouch/.gitignore b/tools/mtouch/.gitignore
index 7decb33553..6534a1e14e 100644
--- a/tools/mtouch/.gitignore
+++ b/tools/mtouch/.gitignore
@@ -1,3 +1,4 @@
+Constants.cs
*.a
*.dylib
*.dSYM
diff --git a/tools/mtouch/Constants.cs.in b/tools/mtouch/Constants.cs.in
new file mode 100644
index 0000000000..5d18001e46
--- /dev/null
+++ b/tools/mtouch/Constants.cs.in
@@ -0,0 +1,6 @@
+namespace Xamarin.Bundler {
+ public static partial class Constants {
+ public const string Version = "@VERSION@";
+ internal const string Revision = "@REVISION@";
+ }
+}
diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile
index 4dde04ae71..616bb3a359 100644
--- a/tools/mtouch/Makefile
+++ b/tools/mtouch/Makefile
@@ -223,6 +223,11 @@ mtouch.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY)
$(MTOUCH_DIR)/mtouch.exe: $(mtouch_dependencies)
$(Q_GEN) $(SYSTEM_MSBUILD) $(TOP)/Xamarin.iOS.sln "/t:mtouch" $(XBUILD_VERBOSITY) /p:Configuration=$(MTOUCH_CONF)
+Constants.cs: Constants.cs.in Makefile $(TOP)/Make.config.inc
+ $(Q_GEN) sed \
+ -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \
+ -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \
+ $< > $@
#
# Partial static registrar libraries
#
diff --git a/tools/mtouch/mtouch.csproj b/tools/mtouch/mtouch.csproj
index 183130fb53..d7b126db85 100644
--- a/tools/mtouch/mtouch.csproj
+++ b/tools/mtouch/mtouch.csproj
@@ -52,9 +52,7 @@
mono-archive\Options.cs
-
- src\build\ios\Constants.cs
-
+
src\ObjCRuntime\Constants.cs