diff --git a/src/xalanc/Utils/CMakeLists.txt b/src/xalanc/Utils/CMakeLists.txt
index dc39ad0..2d78685 100644
--- a/src/xalanc/Utils/CMakeLists.txt
+++ b/src/xalanc/Utils/CMakeLists.txt
@@ -40,6 +40,13 @@ set(SUPPORTMSGINDEX "${GEN_SUPPORTDIR}/LocalMsgIndex.hpp")
 add_custom_target(locale ALL)
 set_target_properties(locale PROPERTIES FOLDER "Message Library")
 
+# workaround for case of missing xerces-c dll
+if(EXISTS ${XercesC_INCLUDE_DIR}/../bin)
+  set(MsgCreator_WD $<TARGET_FILE_DIR:XercesC::XercesC>/../bin)
+else()
+  set(MsgCreator_WD "${XSL_NLS_GEN_DIR}")
+endif()
+
 if(msgloader STREQUAL "inmemory")
   add_custom_command(
     OUTPUT "${GENMSGINDEX}"
@@ -48,7 +55,8 @@ if(msgloader STREQUAL "inmemory")
            "${XLIFF_FILE_NAME}"
            -TYPE inmem
            -LOCALE ${LOCALE}
-    WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}"
+           -OUTDIR "${XSL_NLS_GEN_DIR}"
+    WORKING_DIRECTORY "${MsgCreator_WD}"
     COMMENT "Generating inmemory locale message data"
     DEPENDS MsgCreator "${XLIFF_FILE_NAME}")
 
@@ -92,7 +100,8 @@ if(msgloader STREQUAL "icu")
             "${XLIFF_FILE_NAME}"
             -TYPE icu
             -LOCALE ${LOCALE}
-    WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}"
+            -OUTDIR "${XSL_NLS_GEN_DIR}"
+    WORKING_DIRECTORY "${MsgCreator_WD}"
     COMMENT "Generating ICU locale message data"
     DEPENDS MsgCreator "${XLIFF_FILE_NAME}")
 
@@ -141,7 +150,8 @@ if(msgloader STREQUAL "nls")
             "${XLIFF_FILE_NAME}"
             -TYPE nls
             -LOCALE ${LOCALE}
-    WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}"
+            -OUTDIR "${XSL_NLS_GEN_DIR}"
+    WORKING_DIRECTORY "${MsgCreator_WD}"
     COMMENT "Generating nls locale message data"
     DEPENDS MsgCreator "${XLIFF_FILE_NAME}")
 
