diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake
index 3b73dc82dfcf3fe538d4e6ae230c2b199278f77c..fa4e387dd5c60aac177fb36fa3bfc1ddc0ed2b75 100644
--- a/indra/cmake/TemplateCheck.cmake
+++ b/indra/cmake/TemplateCheck.cmake
@@ -5,7 +5,7 @@ include(Python)
 macro (check_message_template _target)
   add_custom_command(
       TARGET ${_target}
-      PRE_LINK
+      POST_BUILD
       COMMAND ${PYTHON_EXECUTABLE}
       ARGS ${SCRIPTS_DIR}/template_verifier.py
            --mode=development --cache_master
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index be6bce8054f6c658f563bd205db6e33bdf799f12..0fc34ee2487c248dd5de44422ac81299eca7fe02 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1351,7 +1351,6 @@ add_executable(${VIEWER_BINARY_NAME}
     MACOSX_BUNDLE
     ${viewer_SOURCE_FILES}
     )
-check_message_template(${VIEWER_BINARY_NAME})
 
 if (LLKDU_LIBRARY)
   add_dependencies(${VIEWER_BINARY_NAME} ${LLKDU_LIBRARY})
@@ -1388,45 +1387,79 @@ if (WINDOWS)
             )
     endif(USE_PRECOMPILED_HEADERS)
 
-    # sets the 'working directory' for debugging from visual studio.
-    if (NOT UNATTENDED)
-        add_custom_command(
-            TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-            COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe
-            ARGS
-              --solution 
-              ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln
-              --workingdir
-              ${VIEWER_BINARY_NAME}
-              "${CMAKE_CURRENT_SOURCE_DIR}"
-            COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging."
-            )
-    endif (NOT UNATTENDED)
-
-    add_custom_command(
-        TARGET ${VIEWER_BINARY_NAME} PRE_BUILD
-        COMMAND ${CMAKE_COMMAND}
-        ARGS
-          -E
-          copy_if_different
-          ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/messages/message_template.msg
-          ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message_template.msg
-        COMMENT "Copying message_template.msg to the runtime folder."
-        )
-
-    add_custom_command(
-      TARGET ${VIEWER_BINARY_NAME} PRE_BUILD
-      COMMAND ${CMAKE_COMMAND}
-      ARGS
-        -E
-        copy_if_different
-        ${CMAKE_CURRENT_SOURCE_DIR}/../../etc/message.xml
-        ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message.xml
-      COMMENT "Copying message.xml to the runtime folder."
+    # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency
+    # here.
+    # *NOTE:Mani - This is a crappy hack to have important dependecies for the viewer_manifest copy action
+    # be met. I'm looking forward to a source-code split-up project next year that will address this kind of thing.
+    # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
+    # and have the build deps get tracked *please* tell me about it.
+    set(COPY_INPUT_DEPENDECIES
+      # The following commented dependencies are determined at variably at build time. Can't do this here.
+      #llkdu.dll => llkdu.dll
+      #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll
+      ${CMAKE_SOURCE_DIR}/../etc/message.xml
+      ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll
+      ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll
+      ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll
+      ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll
+      ${SHARED_LIB_STAGING_DIR}/Release/msvcr80.dll
+      ${SHARED_LIB_STAGING_DIR}/Release/msvcp80.dll
+      ${SHARED_LIB_STAGING_DIR}/Release/Microsoft.VC80.CRT.manifest
+      ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/msvcr80.dll
+      ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/msvcp80.dll
+      ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest
+      ${SHARED_LIB_STAGING_DIR}/Debug/msvcr80d.dll
+      ${SHARED_LIB_STAGING_DIR}/Debug/msvcp80d.dll
+      ${SHARED_LIB_STAGING_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/zlib1.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxplatform.dll
+      ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll
+      ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt
+      ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt
+      ${CMAKE_CURRENT_SOURCE_DIR}/dbghelp.dll
+      ${CMAKE_CURRENT_SOURCE_DIR}/fmod.dll
+      ${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}/media_plugin_quicktime.dll
+      ${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}/media_plugin_webkit.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/libeay32.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/qtcore4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/qtgui4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/qtnetwork4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/qtopengl4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/qtwebkit4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/ssleay32.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qgif4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qico4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qjpeg4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qmng4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qsvg4.dll
+      ${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qtiff4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/libeay32.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/qtcored4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/qtguid4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/qtnetworkd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/qtopengld4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/qtwebkitd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/ssleay32.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qgifd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qicod4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qjpegd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qmngd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qsvgd4.dll
+      ${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qtiffd4.dll
+      windows-crash-logger
+      windows-updater
       )
-       
+
     add_custom_command(
-      TARGET ${VIEWER_BINARY_NAME} POST_BUILD
+      OUTPUT  ${CMAKE_CFG_INTDIR}/copy_touched.bat
       COMMAND ${PYTHON_EXECUTABLE}
       ARGS
         ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
@@ -1437,11 +1470,16 @@ if (WINDOWS)
         --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
         --grid=${GRID}
         --source=${CMAKE_CURRENT_SOURCE_DIR}
-      DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+	--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
+      DEPENDS 
+	${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+	${COPY_INPUT_DEPENDECIES}
       COMMENT "Performing viewer_manifest copy"
       )
+    
+    add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat) 
 
-    add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon)
+    add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest)
     
     if(LLKDU_LIBRARY)
       # kdu may not exist!
@@ -1460,6 +1498,21 @@ if (WINDOWS)
       windows-crash-logger
       )
 
+    # sets the 'working directory' for debugging from visual studio.
+    if (NOT UNATTENDED)
+        add_custom_command(
+            TARGET ${VIEWER_BINARY_NAME} POST_BUILD
+            COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe
+            ARGS
+              --solution 
+              ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln
+              --workingdir
+              ${VIEWER_BINARY_NAME}
+              "${CMAKE_CURRENT_SOURCE_DIR}"
+            COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging."
+            )
+    endif (NOT UNATTENDED)
+
     if (PACKAGE)
       add_custom_command(
         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2
@@ -1474,7 +1527,7 @@ if (WINDOWS)
           ${EVENT_HOST_SCRIPTS}
           ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py
         )
-
+    
       add_custom_command(
         OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat
         COMMAND ${PYTHON_EXECUTABLE}
@@ -1497,6 +1550,8 @@ if (WINDOWS)
         # sorted out on the parabuild cluster...
         #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2)
 
+      check_message_template(package)
+
     endif (PACKAGE)
 endif (WINDOWS)
 
@@ -1578,6 +1633,7 @@ if (LINUX)
     add_custom_target(package ALL DEPENDS ${product}.tar.bz2)
     add_dependencies(package linux-crash-logger-strip-target)
     add_dependencies(package linux-updater-strip-target)
+    check_message_template(package)
   endif (NOT INSTALL)
 endif (LINUX)
 
@@ -1616,6 +1672,7 @@ if (DARWIN)
 
   if (PACKAGE)
       add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME}) 
+      check_message_template(package)
       add_dependencies(package mac-updater mac-crash-logger)
 
       add_custom_command(
@@ -1719,119 +1776,3 @@ if (LL_TESTS)
 endif (LL_TESTS)
 
 
-# Don't do these for DARWIN or LINUX here -- they're taken care of by viewer_manifest.py
-if (WINDOWS)
-  add_custom_command(
-      TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-      COMMAND ${CMAKE_COMMAND}
-      ARGS
-        -E
-        make_directory
-        ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin
-      COMMENT "Creating llplugin dir."
-      )
-
-  get_target_property(BUILT_SLPLUGIN SLPlugin LOCATION)
-  add_custom_command(
-      TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-      COMMAND ${CMAKE_COMMAND}
-      ARGS
-        -E
-        copy_if_different
-        ${BUILT_SLPLUGIN}
-        ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
-      COMMENT "Copying SLPlugin executable to the runtime folder."
-      )
-
-  get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION)
-    add_custom_command(
-        TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-        COMMAND ${CMAKE_COMMAND}
-        ARGS
-          -E
-          copy_if_different
-          ${BUILT_WEBKIT_PLUGIN}
-          ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin
-        COMMENT "Copying WebKit Plugin to the runtime folder."
-        )
-
-  get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION)
-    add_custom_command(
-        TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-        COMMAND ${CMAKE_COMMAND}
-        ARGS
-          -E
-          copy_if_different
-          ${BUILT_QUICKTIME_PLUGIN}
-          ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin
-        COMMENT "Copying Quicktime Plugin to the runtime folder."
-        )
-
-  #*******************************
-  # Copy media plugin support dlls
-  # Debug config runtime files required for the plugins
-  set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
-  set(plugins_debug_files
-    libeay32.dll
-    qtcored4.dll
-    qtguid4.dll
-    qtnetworkd4.dll
-    qtopengld4.dll
-    qtwebkitd4.dll
-    ssleay32.dll
-    )
-  copy_if_different(
-    ${plugins_debug_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/Debug/llplugin"
-    out_targets
-    ${plugins_debug_files}
-    )
-  set(media_plugin_targets ${media_plugin_targets} ${out_targets})
-  
-  # Release & ReleaseDebInfo config runtime files required for the plugins
-  set(plugins_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
-  set(plugins_release_files
-    libeay32.dll
-    qtcore4.dll
-    qtgui4.dll
-    qtnetwork4.dll
-    qtopengl4.dll
-    qtwebkit4.dll
-    ssleay32.dll
-    )
-  copy_if_different(
-    ${plugins_release_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/Release/llplugin"
-    out_targets
-    ${plugins_release_files}
-    )
-  set(media_plugin_targets ${media_plugin_targets} ${out_targets})
-
-  copy_if_different(
-    ${plugins_release_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/llplugin"
-    out_targets
-    ${plugins_release_files}
-    )
-  set(media_plugin_targets ${media_plugin_targets} ${out_targets})
-  
-  add_custom_target(copy_media_plugin_libs ALL
-    DEPENDS 
-    ${media_plugin_targets}
-    )
-
-  add_custom_command(
-    TARGET ${VIEWER_BINARY_NAME} POST_BUILD
-    COMMAND ${CMAKE_COMMAND}
-    ARGS
-      -E
-      copy_directory
-      ${CMAKE_BINARY_DIR}/test_apps/llplugintest/${CMAKE_CFG_INTDIR}/imageformats
-      ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin/imageformats
-    COMMENT "Copying llpluging imageformat libs."
-    )
-
-  add_dependencies(${VIEWER_BINARY_NAME} llmediaplugintest copy_media_plugin_libs)
-
-endif (WINDOWS)
-
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 413331548050ab27cb9cdd1bf335bee0d836b340..1e13d6a031118ba4820cfacdd74d2a084918b463 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -40,67 +40,73 @@
 from llmanifest import LLManifest, main, proper_windows_path, path_ancestors
 
 class ViewerManifest(LLManifest):
+    def is_packaging_viewer(self):
+        # This is overridden by the WindowsManifest sub-class,
+        # which has different behavior if it is not packaging the viewer.
+        return True
+    
     def construct(self):
         super(ViewerManifest, self).construct()
         self.exclude("*.svn*")
         self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg")
         self.path(src="../../etc/message.xml", dst="app_settings/message.xml")
 
-        if self.prefix(src="app_settings"):
-            self.exclude("logcontrol.xml")
-            self.exclude("logcontrol-dev.xml")
-            self.path("*.pem")
-            self.path("*.ini")
-            self.path("*.xml")
-            self.path("*.db2")
-
-            # include the entire shaders directory recursively
-            self.path("shaders")
-            # ... and the entire windlight directory
-            self.path("windlight")
-            self.end_prefix("app_settings")
-
-        if self.prefix(src="character"):
-            self.path("*.llm")
-            self.path("*.xml")
-            self.path("*.tga")
-            self.end_prefix("character")
-
-        # Include our fonts
-        if self.prefix(src="fonts"):
-            self.path("*.ttf")
-            self.path("*.txt")
-            self.end_prefix("fonts")
-
-        # skins
-        if self.prefix(src="skins"):
-                self.path("paths.xml")
-                # include the entire textures directory recursively
-                if self.prefix(src="*/textures"):
-                        self.path("*/*.tga")
-                        self.path("*/*.j2c")
-                        self.path("*/*.jpg")
-                        self.path("*/*.png")
-                        self.path("*.tga")
-                        self.path("*.j2c")
-                        self.path("*.jpg")
-                        self.path("*.png")
-                        self.path("textures.xml")
-                        self.end_prefix("*/textures")
-                self.path("*/xui/*/*.xml")
-                self.path("*/xui/*/widgets/*.xml")
-                self.path("*/*.xml")
-                
-                # Local HTML files (e.g. loading screen)
-                if self.prefix(src="*/html"):
-                        self.path("*.png")
-                        self.path("*/*/*.html")
-                        self.path("*/*/*.gif")
-                        self.end_prefix("*/html")
-                self.end_prefix("skins")
-        
-        # Files in the newview/ directory
-        self.path("gpu_table.txt")
+        if self.is_packaging_viewer():
+            if self.prefix(src="app_settings"):
+                self.exclude("logcontrol.xml")
+                self.exclude("logcontrol-dev.xml")
+                self.path("*.pem")
+                self.path("*.ini")
+                self.path("*.xml")
+                self.path("*.db2")
+
+                # include the entire shaders directory recursively
+                self.path("shaders")
+                # ... and the entire windlight directory
+                self.path("windlight")
+                self.end_prefix("app_settings")
+
+            if self.prefix(src="character"):
+                self.path("*.llm")
+                self.path("*.xml")
+                self.path("*.tga")
+                self.end_prefix("character")
+
+            # Include our fonts
+            if self.prefix(src="fonts"):
+                self.path("*.ttf")
+                self.path("*.txt")
+                self.end_prefix("fonts")
+
+            # skins
+            if self.prefix(src="skins"):
+                    self.path("paths.xml")
+                    # include the entire textures directory recursively
+                    if self.prefix(src="*/textures"):
+                            self.path("*/*.tga")
+                            self.path("*/*.j2c")
+                            self.path("*/*.jpg")
+                            self.path("*/*.png")
+                            self.path("*.tga")
+                            self.path("*.j2c")
+                            self.path("*.jpg")
+                            self.path("*.png")
+                            self.path("textures.xml")
+                            self.end_prefix("*/textures")
+                    self.path("*/xui/*/*.xml")
+                    self.path("*/xui/*/widgets/*.xml")
+                    self.path("*/*.xml")
+
+                    # Local HTML files (e.g. loading screen)
+                    if self.prefix(src="*/html"):
+                            self.path("*.png")
+                            self.path("*/*/*.html")
+                            self.path("*/*/*.gif")
+                            self.end_prefix("*/html")
+                    self.end_prefix("skins")
+
+            # Files in the newview/ directory
+            self.path("gpu_table.txt")
 
     def login_channel(self):
         """Channel reported for login and upgrade purposes ONLY;
@@ -163,6 +169,12 @@ def final_exe(self):
         else:
             return ''.join(self.channel().split()) + '.exe'
 
+    def is_packaging_viewer(self):
+        # Some commands, files will only be included
+        # if we are packaging the viewer on windows.
+        # This manifest is also used to copy
+        # files during the build.
+        return 'package' in self.args['actions']
 
     def test_msvcrt_and_copy_action(self, src, dst):
         # This is used to test a dll manifest.
@@ -211,22 +223,25 @@ def test_for_no_msvcrt_manifest_and_copy_action(self, src, dst):
             print "Doesn't exist:", src
         
     def enable_crt_manifest_check(self):
-        WindowsManifest.copy_action = WindowsManifest.test_msvcrt_and_copy_action
+        if self.is_packaging_viewer():
+           WindowsManifest.copy_action = WindowsManifest.test_msvcrt_and_copy_action
 
     def enable_no_crt_manifest_check(self):
-        WindowsManifest.copy_action = WindowsManifest.test_for_no_msvcrt_manifest_and_copy_action
+        if self.is_packaging_viewer():
+            WindowsManifest.copy_action = WindowsManifest.test_for_no_msvcrt_manifest_and_copy_action
 
     def disable_manifest_check(self):
-        del WindowsManifest.copy_action
+        if self.is_packaging_viewer():
+            del WindowsManifest.copy_action
 
     def construct(self):
         super(WindowsManifest, self).construct()
 
         self.enable_crt_manifest_check()
 
-        # Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.
-        self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe())
-
+        if self.is_packaging_viewer():
+            # Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.
+            self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe())
 
         # Plugin host application
         self.path(os.path.join(os.pardir,
@@ -316,26 +331,47 @@ def construct(self):
         if self.prefix(src='../media_plugins/webkit/%s' % self.args['configuration'], dst="llplugin"):
             self.path("media_plugin_webkit.dll")
             self.end_prefix()
-            
-        if self.prefix(src="../../libraries/i686-win32/lib/release", dst="llplugin"):
-            self.path("libeay32.dll")
-            self.path("qtcore4.dll")
-            self.path("qtgui4.dll")
-            self.path("qtnetwork4.dll")
-            self.path("qtopengl4.dll")
-            self.path("qtwebkit4.dll")
-            self.path("ssleay32.dll")
-            self.end_prefix()
 
-        # For WebKit/Qt plugin runtimes (image format plugins)
-        if self.prefix(src="../../libraries/i686-win32/lib/release/imageformats", dst="llplugin/imageformats"):
-            self.path("qgif4.dll")
-            self.path("qico4.dll")
-            self.path("qjpeg4.dll")
-            self.path("qmng4.dll")
-            self.path("qsvg4.dll")
-            self.path("qtiff4.dll")
-            self.end_prefix()
+        if self.args['configuration'].lower() == 'debug':
+            if self.prefix(src="../../libraries/i686-win32/lib/debug", dst="llplugin"):
+                self.path("libeay32.dll")
+                self.path("qtcored4.dll")
+                self.path("qtguid4.dll")
+                self.path("qtnetworkd4.dll")
+                self.path("qtopengld4.dll")
+                self.path("qtwebkitd4.dll")
+                self.path("ssleay32.dll")
+                self.end_prefix()
+
+            # For WebKit/Qt plugin runtimes (image format plugins)
+            if self.prefix(src="../../libraries/i686-win32/lib/debug/imageformats", dst="llplugin/imageformats"):
+                self.path("qgif4d.dll")
+                self.path("qico4d.dll")
+                self.path("qjpeg4d.dll")
+                self.path("qmng4d.dll")
+                self.path("qsvg4d.dll")
+                self.path("qtiff4d.dll")
+                self.end_prefix()
+        else:
+            if self.prefix(src="../../libraries/i686-win32/lib/release", dst="llplugin"):
+                self.path("libeay32.dll")
+                self.path("qtcore4.dll")
+                self.path("qtgui4.dll")
+                self.path("qtnetwork4.dll")
+                self.path("qtopengl4.dll")
+                self.path("qtwebkit4.dll")
+                self.path("ssleay32.dll")
+                self.end_prefix()
+
+            # For WebKit/Qt plugin runtimes (image format plugins)
+            if self.prefix(src="../../libraries/i686-win32/lib/release/imageformats", dst="llplugin/imageformats"):
+                self.path("qgif4.dll")
+                self.path("qico4.dll")
+                self.path("qjpeg4.dll")
+                self.path("qmng4.dll")
+                self.path("qsvg4.dll")
+                self.path("qtiff4.dll")
+                self.end_prefix()
 
         self.disable_manifest_check()
 
@@ -346,6 +382,9 @@ def construct(self):
         self.path(src='../win_updater/%s/windows-updater.exe' % self.args['configuration'],
                   dst="updater.exe")
 
+        if not self.is_packaging_viewer():
+            self.package_file = "copied_deps"    
+
     def nsi_file_commands(self, install=True):
         def wpath(path):
             if path.endswith('/') or path.endswith(os.path.sep):