diff --git a/build-windows/generate_code.cmd b/build-windows/generate_code.cmd
new file mode 100644
index 00000000..d9f58beb
--- /dev/null
+++ b/build-windows/generate_code.cmd
@@ -0,0 +1,18 @@
+pushd .
+cd %1\sync
+
+python %YML_PATH%\yml2proc -E utf-8 -y gen_actions.ysl2 sync.fsm
+python %YML_PATH%\yml2proc -E utf-8 -y gen_statemachine.ysl2 sync.fsm
+python %YML_PATH%\yml2proc -E utf-8 -y gen_codec.ysl2 sync.fsm
+python %YML_PATH%\yml2proc -E utf-8 -y gen_messages sync.fsm
+python %YML_PATH%\yml2proc -E utf-8 -y gen_message_func sync.fsm
+
+xcopy /y generated\*.asn1 ..\asn.1\
+xcopy /y generated\*.c ..\src\
+xcopy /y generated\*.h ..\src\
+
+cd %1\asn.1
+
+..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 keysync.asn1 sync.asn1
+
+popd
diff --git a/build-windows/pEpEngine.vcxproj b/build-windows/pEpEngine.vcxproj
index ca7dbc0c..05727518 100644
--- a/build-windows/pEpEngine.vcxproj
+++ b/build-windows/pEpEngine.vcxproj
@@ -43,12 +43,12 @@
true
false
- $(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c
+ $(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c
$(ProjectDir)\..\..\libetpan\build-windows\Debug;$(LibraryPath)
false
- $(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c
+ $(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c
$(ProjectDir)\..\..\libetpan\build-windows\Release;$(LibraryPath)
@@ -68,10 +68,7 @@
$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)
- cd "$(ProjectDir)..\sync" && python "%YML_PATH%\yml2proc" -E utf-8 -y gen_statemachine.ysl2 devicegroup.fsm -o .statemachines
-cd "$(ProjectDir)..\sync" && python "%YML_PATH%\yml2proc" -E utf-8 -ygen_actions.ysl2 devicegroup.fsm -o .skeletons
-cd "$(ProjectDir)..\sync" && xcopy generated\*.c ..\src\ /y
-cd "$(ProjectDir)..\sync" && xcopy generated\*.h ..\src\ /y
+ cmd /c "$(ProjectDir)build_windows\generate_code.cmd" "$(ProjectDir)"
@@ -98,10 +95,7 @@ cd "$(ProjectDir)..\sync" && xcopy generated\*.h ..\src\ /y
$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)
- cd "$(ProjectDir)..\sync" && python "%YML_PATH%\yml2proc" -E utf-8 -y gen_statemachine.ysl2 devicegroup.fsm -o .statemachines
-cd "$(ProjectDir)..\sync" && python "%YML_PATH%\yml2proc" -E utf-8 -ygen_actions.ysl2 devicegroup.fsm -o .skeletons
-cd "$(ProjectDir)..\sync" && xcopy generated\*.c ..\src\ /y
-cd "$(ProjectDir)..\sync" && xcopy generated\*.h ..\src\ /y
+ cmd /c "$(ProjectDir)build_windows\generate_code.cmd" "$(ProjectDir)"