diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 52d84e8bcecd240f9b97ac02623d1d1c1989b97b..73c9f397e519f9dae375596cfd0c8bc4cfa78bd0 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -187,8 +187,10 @@ const char _slnProjDepEnd[]     = "\n\tEndProjectSection";
 const char _slnProjConfBeg[]    = "\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution";
 const char _slnProjRelConfTag1[]= ".Release|%1.ActiveCfg = Release|";
 const char _slnProjRelConfTag2[]= ".Release|%1.Build.0 = Release|";
+const char _slnProjRelConfTag3[]= ".Release|%1.Deploy.0 = Release|";
 const char _slnProjDbgConfTag1[]= ".Debug|%1.ActiveCfg = Debug|";
 const char _slnProjDbgConfTag2[]= ".Debug|%1.Build.0 = Debug|";
+const char _slnProjDbgConfTag3[]= ".Debug|%1.Deploy.0 = Debug|";
 const char _slnProjConfEnd[]    = "\n\tEndGlobalSection";
 const char _slnExtSections[]    = "\n\tGlobalSection(ExtensibilityGlobals) = postSolution"
                                   "\n\tEndGlobalSection"
@@ -729,8 +731,12 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
             platform = xplatform;
         t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag1).arg(xplatform) << platform;
         t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag2).arg(xplatform) << platform;
+        if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
+            t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag3).arg(xplatform) << platform;
         t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag1).arg(xplatform) << platform;
         t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag2).arg(xplatform) << platform;
+        if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
+            t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag3).arg(xplatform) << platform;
     }
     t << _slnProjConfEnd;
     t << _slnExtSections;
@@ -1269,6 +1275,7 @@ void VcprojGenerator::initDeploymentTool()
             targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET");
         if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
             targetPath.chop(1);
+        conf.deployment.RemoteDirectory = targetPath;
     }
     ProStringList dllPaths = project->values("QMAKE_DLL_PATHS");
     // Only deploy Qt libs for shared build
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 418426b0272a6d16d5363eed1b0b54323b7f2a28..b599df45e3daa049f68572fd2f628ed6bdc98635 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3176,9 +3176,6 @@ void Configure::generateCachefile()
             moduleStream << "QT_CE_RAPI_LIB  = " << formatPath(dictionary["QT_CE_RAPI_LIB"]) << endl;
         }
 
-        moduleStream << "#Qt for Windows CE c-runtime deployment" << endl
-                     << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl;
-
         if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
             moduleStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
 
@@ -3594,6 +3591,11 @@ void Configure::generateQConfigPri()
                          << "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl;
         }
 
+        if (dictionary.value("XQMAKESPEC").startsWith("wince")) {
+            configStream << "#Qt for Windows CE c-runtime deployment" << endl
+                         << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl;
+        }
+
         if (!configStream.flush())
             dictionary[ "DONE" ] = "error";
     }