diff --git a/core/config/schema/core.extension.schema.yml b/core/config/schema/core.extension.schema.yml
index bdc84b9..954df35 100644
--- a/core/config/schema/core.extension.schema.yml
+++ b/core/config/schema/core.extension.schema.yml
@@ -14,3 +14,19 @@ core.extension:
       sequence:
         type: integer
         label: 'Weight'
+    installed:
+      type: mapping
+      label: 'Version at install time'
+      mapping:
+        module:
+          type: sequence
+          label: 'Modules'
+          sequence:
+            type: string
+            label: 'Version'
+        theme:
+          type: sequence
+          label: 'Themes'
+          sequence:
+            type: string
+            label: 'Version'
diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
index 6a69082..69b5241 100644
--- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
@@ -115,6 +115,12 @@ protected function validateModules(ConfigImporter $config_importer) {
         );
         $config_importer->logError($message);
       }
+      if ($core_extension['installed']['module'][$module] !== $module_data[$module]->info['version']) {
+        $config_importer->logError($this->t(
+          'Unable to install the %module module since the installed version (@config_version) does not match the code base (@code_version).',
+          ['%module' => $module, '@config_version' => $core_extension['installed']['module'][$module], '@code_version' => $module_data[$module]->info['version']]
+        ));
+      }
     }
 
     // Settings is safe to use because settings.php is written before any module
@@ -169,6 +175,12 @@ protected function validateThemes(ConfigImporter $config_importer) {
           $config_importer->logError($this->t('Unable to install the %theme theme since it requires the %required_theme theme.', array('%theme' => $theme_name, '%required_theme' => $required_theme_name)));
         }
       }
+      if ($core_extension['installed']['theme'][$theme] !== $theme_data[$theme]->info['version']) {
+        $config_importer->logError($this->t(
+          'Unable to install the %theme theme since the installed version (@config_version) does not match the code base (@code_version).',
+          ['%theme' => $theme, '@config_version' => $core_extension['installed']['theme'][$theme], '@code_version' => $theme_data[$theme]->info['version']]
+        ));
+      }
     }
 
     // Ensure that all themes being uninstalled are not required by themes that
diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
index f8300cb..060edba 100644
--- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
@@ -294,6 +294,16 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
 
     // If any modules were newly installed, invoke hook_modules_installed().
     if (!empty($modules_installed)) {
+      // Update installed version list.
+      $list = $this->moduleHandler->getModuleList();
+      $installed_versions = $extension_config->get('installed.module');
+      foreach ($modules_installed as $module_name) {
+        $info = \Drupal::service('info_parser')->parse($list[$module_name]->getPathname());
+        $installed_versions[$module_name] = $info['version'];
+      }
+      ksort($installed_versions);
+      $extension_config->set('installed.module', $installed_versions);
+      $extension_config->save();
       \Drupal::service('router.builder')->setRebuildNeeded();
       $this->moduleHandler->invokeAll('modules_installed', array($modules_installed));
     }
@@ -414,7 +424,11 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
 
       // Remove the module's entry from the config. Don't check schema when
       // uninstalling a module since we are only clearing a key.
-      \Drupal::configFactory()->getEditable('core.extension')->clear("module.$module")->save(TRUE);
+      \Drupal::configFactory()
+        ->getEditable('core.extension')
+        ->clear("module.$module")
+        ->clear("installed.module.$module")
+        ->save(TRUE);
 
       // Update the module handler to remove the module.
       // The current ModuleHandler instance is obsolete with the kernel rebuild
diff --git a/core/lib/Drupal/Core/Extension/ThemeInstaller.php b/core/lib/Drupal/Core/Extension/ThemeInstaller.php
index b3b391e..03f027a 100644
--- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php
@@ -170,8 +170,12 @@ public function install(array $theme_list, $install_dependencies = TRUE) {
 
       // The value is not used; the weight is ignored for themes currently. Do
       // not check schema when saving the configuration.
+      $installed_versions = $extension_config->get('installed.theme');
+      $installed_versions[$key] = $theme_data[$key]->info['version'];
+      ksort($installed_versions);
       $extension_config
         ->set("theme.$key", 0)
+        ->set('installed.theme', $installed_versions)
         ->save(TRUE);
 
       // Add the theme to the current list.
@@ -248,7 +252,9 @@ public function uninstall(array $theme_list) {
     $current_theme_data = $this->state->get('system.theme.data', array());
     foreach ($theme_list as $key) {
       // The value is not used; the weight is ignored for themes currently.
-      $extension_config->clear("theme.$key");
+      $extension_config
+        ->clear("theme.$key")
+        ->clear("installed.theme.$key");
 
       // Update the current theme data accordingly.
       unset($current_theme_data[$key]);
diff --git a/core/modules/config/src/Tests/ConfigImportUITest.php b/core/modules/config/src/Tests/ConfigImportUITest.php
index 86d59ee..7842d12 100644
--- a/core/modules/config/src/Tests/ConfigImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigImportUITest.php
@@ -84,9 +84,15 @@ function testImport() {
     $core_extension['module']['action'] = 0;
     $core_extension['module']['ban'] = 0;
     $core_extension['module'] = module_config_sort($core_extension['module']);
+    $core_extension['installed']['module']['action'] = \Drupal::VERSION;
+    $core_extension['installed']['module']['ban'] = \Drupal::VERSION;
+    ksort($core_extension['installed']['module']);
     // Bartik is a subtheme of classy so classy must be enabled.
     $core_extension['theme']['classy'] = 0;
     $core_extension['theme']['bartik'] = 0;
+    $core_extension['installed']['theme']['classy'] = \Drupal::VERSION;
+    $core_extension['installed']['theme']['bartik'] = \Drupal::VERSION;
+    ksort($core_extension['installed']['theme']);
     $sync->write('core.extension', $core_extension);
 
     // Use the install storage so that we can read configuration from modules
@@ -175,6 +181,11 @@ function testImport() {
     unset($core_extension['module']['options']);
     unset($core_extension['module']['text']);
     unset($core_extension['theme']['bartik']);
+    unset($core_extension['installed']['module']['action']);
+    unset($core_extension['installed']['module']['ban']);
+    unset($core_extension['installed']['module']['options']);
+    unset($core_extension['installed']['module']['text']);
+    unset($core_extension['installed']['theme']['bartik']);
     $sync->write('core.extension', $core_extension);
     $sync->delete('action.settings');
     $sync->delete('text.settings');
@@ -507,6 +518,13 @@ public function testExtensionValidation() {
     $core['module']['does_not_exist'] = 0;
     // This theme does not exist.
     $core['theme']['does_not_exist'] = 0;
+    // This module does exist but the version is wrong.
+    $core['module']['ban'] = 0;
+    $core['installed']['module']['ban'] = '8.0.0-rc3';
+    // This theme does exist but the version is wrong.
+    $core['theme']['seven'] = 0;
+    $core['installed']['theme']['seven'] = '8.0.0-rc3';
+
     $sync->write('core.extension', $core);
 
     $this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
@@ -515,6 +533,8 @@ public function testExtensionValidation() {
     $this->assertText('Unable to uninstall the Classy theme since the Bartik theme is installed.');
     $this->assertText('Unable to install the does_not_exist module since it does not exist.');
     $this->assertText('Unable to install the does_not_exist theme since it does not exist.');
+    $this->assertText('Unable to install the ban module since the installed version (8.0.0-rc3) does not match the code base (' . \Drupal::VERSION . ').');
+    $this->assertText('Unable to install the seven theme since the installed version (8.0.0-rc3) does not match the code base (' . \Drupal::VERSION . ').');
   }
 
 }
