diff --git a/core/config/install/core.extension.yml b/core/config/install/core.extension.yml
index ce74bae..ff9a4ba 100644
--- a/core/config/install/core.extension.yml
+++ b/core/config/install/core.extension.yml
@@ -1,2 +1,3 @@
 module: {}
 theme: {}
+versions: {}
diff --git a/core/config/schema/core.extension.schema.yml b/core/config/schema/core.extension.schema.yml
index bdc84b9..9565d8a 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'
+    versions:
+      type: sequence
+      label: 'Version information'
+      sequence:
+        type: mapping
+        label: 'Extensions'
+        mapping:
+          current:
+            type: string
+            label: 'Currently installed version'
+          install:
+            type: string
+            label: 'Version at install time'
+          schema:
+            type: string
+            label: 'Currently installed schema version'
diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index 4712d3b..e4e2a29 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -104,6 +104,9 @@ function drupal_get_installed_schema_version($module, $reset = FALSE, $array = F
  */
 function drupal_set_installed_schema_version($module, $version) {
   \Drupal::keyValue('system.schema')->set($module, $version);
+  // Store the information in config so that we can ensure that database updates
+  // are the same between the source and the target site instances.
+  \Drupal::configFactory()->getEditable('core.extension')->set("versions.$module.schema", (string) $version);
   // Reset the static cache of module schema versions.
   drupal_get_installed_schema_version(NULL, TRUE);
 }
diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
index 6a69082..b44c561 100644
--- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
@@ -72,14 +72,33 @@ public function onConfigImporterValidate(ConfigImporterEvent $event) {
       }
     }
     $config_importer = $event->getConfigImporter();
-    if ($config_importer->getStorageComparer()->getSourceStorage()->exists('core.extension')) {
+    if ($this->validateCoreExtension($config_importer)) {
       $this->validateModules($config_importer);
       $this->validateThemes($config_importer);
       $this->validateDependencies($config_importer);
     }
-    else {
+  }
+
+  /**
+   * Validates the core.extension configuration file.
+   *
+   * @param \Drupal\Core\Config\ConfigImporter $config_importer
+   *   The configuration importer.
+   *
+   * @return bool
+   *   TRUE if the core.extension is valid, FALSE if not.
+   */
+  protected function validateCoreExtension(ConfigImporter $config_importer) {
+    $data = $config_importer->getStorageComparer()->getSourceStorage()->read('core.extension');
+    if ($data === FALSE) {
       $config_importer->logError($this->t('The core.extension configuration does not exist.'));
+      return FALSE;
     }
+    elseif (empty($data['versions'])) {
+      $config_importer->logError($this->t('The core.extension file is out-of-date. Update the codebase of the source site, run update.php and export the configuration again.'));
+      return FALSE;
+    }
+    return TRUE;
   }
 
   /**
@@ -97,6 +116,23 @@ protected function validateModules(ConfigImporter $config_importer) {
       $config_importer->logError($this->t('Unable to install the %module module since it does not exist.', array('%module' => $module)));
     }
 
+    $existing_modules = array_keys(array_intersect_key($core_extension['module'], $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension')['module']));
+    foreach ($existing_modules as $module) {
+      if ($core_extension['versions'][$module]['current'] !== $module_data[$module]->info['version']) {
+        $config_importer->logError($this->t(
+          'Unable to import configuration because the version of %module module on the source site (@source_version) does not match this site (@target_version).',
+          ['%module' => $module, '@source_version' => $core_extension['versions'][$module]['current'], '@target_version' => $module_data[$module]->info['version']]
+        ));
+      }
+      elseif ($core_extension['versions'][$module]['schema'] !== (string) drupal_get_installed_schema_version($module)) {
+        $config_importer->logError($this->t(
+          'Unable to import configuration because the schema version of %module module on the source site (@source_schema) does not match this site (@target_schema).',
+          ['%module' => $module, '@source_schema' => $core_extension['versions'][$module]['schema'], '@target_schema' => drupal_get_installed_schema_version($module)]
+        ));
+
+      }
+    }
+
     // Ensure that all modules being installed have their dependencies met.
     $installs = $config_importer->getExtensionChangelist('module', 'install');
     foreach ($installs as $module) {
@@ -115,6 +151,12 @@ protected function validateModules(ConfigImporter $config_importer) {
         );
         $config_importer->logError($message);
       }
+      if ($core_extension['versions'][$module]['install'] !== $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['versions'][$module]['install'], '@code_version' => $module_data[$module]->info['version']]
+        ));
+      }
     }
 
     // Settings is safe to use because settings.php is written before any module
@@ -160,6 +202,16 @@ protected function validateThemes(ConfigImporter $config_importer) {
       }
     }
 
+    $existing_themes = array_keys(array_intersect_key($core_extension['theme'], $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension')['theme']));
+    foreach ($existing_themes as $theme) {
+      if ($core_extension['versions'][$theme]['current'] !== $theme_data[$theme]->info['version']) {
+        $config_importer->logError($this->t(
+          'Unable to import configuration because the version of %theme theme on the source site (@source_version) does not match this site (@target_version).',
+          ['%theme' => $theme, '@source_version' => $core_extension['versions'][$theme]['current'], '@target_version' => $theme_data[$theme]->info['version']]
+        ));
+      }
+    }
+
     // Ensure that all themes being installed have their dependencies met.
     foreach ($installs as $theme) {
       foreach (array_keys($theme_data[$theme]->requires) as $required_theme) {
@@ -169,6 +221,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['versions'][$theme]['install'] !== $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['versions'][$theme]['install'], '@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/InfoParserDynamic.php b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
index 64e4941..0ea95f0 100644
--- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
+++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
@@ -36,6 +36,9 @@ public function parse($filename) {
       if (isset($parsed_info['version']) && $parsed_info['version'] === 'VERSION') {
         $parsed_info['version'] = \Drupal::VERSION;
       }
+      if (!isset($parsed_info['version'])) {
+        $parsed_info['version'] = 'None';
+      }
     }
     return $parsed_info;
   }
diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
index f8300cb..afd9bd2 100644
--- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
@@ -294,6 +294,21 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
 
     // If any modules were newly installed, invoke hook_modules_installed().
     if (!empty($modules_installed)) {
+      // There will be a new config factory.
+      $extension_config = \Drupal::configFactory()->getEditable('core.extension');
+      // Update version information in configuration.
+      $list = $this->moduleHandler->getModuleList();
+      $versions = $extension_config->get('versions');
+      foreach ($modules_installed as $module_name) {
+        $info = \Drupal::service('info_parser')->parse($list[$module_name]->getPathname());
+        $versions[$module_name] = [
+          'current' => $info['version'],
+          'install' => $info['version'],
+          'schema' => (string) drupal_get_installed_schema_version($module_name),
+        ];
+      }
+      ksort($versions);
+      $extension_config->set('versions', $versions)->save();
       \Drupal::service('router.builder')->setRebuildNeeded();
       $this->moduleHandler->invokeAll('modules_installed', array($modules_installed));
     }
@@ -414,7 +429,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("versions.$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..006eb94 100644
--- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php
@@ -170,8 +170,15 @@ 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.
+      $versions = $extension_config->get('versions');
+      $versions[$key] = [
+        'current' => $theme_data[$key]->info['version'],
+        'install' => $theme_data[$key]->info['version'],
+      ];
+      ksort($versions);
       $extension_config
         ->set("theme.$key", 0)
+        ->set('versions', $versions)
         ->save(TRUE);
 
       // Add the theme to the current list.
@@ -248,7 +255,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("versions.$key");
 
       // Update the current theme data accordingly.
       unset($current_theme_data[$key]);
diff --git a/core/modules/config/src/Tests/ConfigImportInstallProfileTest.php b/core/modules/config/src/Tests/ConfigImportInstallProfileTest.php
index e15d3ac..19ee917 100644
--- a/core/modules/config/src/Tests/ConfigImportInstallProfileTest.php
+++ b/core/modules/config/src/Tests/ConfigImportInstallProfileTest.php
@@ -67,8 +67,13 @@ public function testInstallProfileValidation() {
     $core['module']['testing_config_import'] = 0;
     unset($core['module']['syslog']);
     unset($core['theme']['stark']);
+    unset($core['versions']['syslog']);
+    unset($core['versions']['stark']);
     $core['theme']['stable'] = 0;
     $core['theme']['classy'] = 0;
+    $core['versions']['stable'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
+    $core['versions']['classy'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
+    ksort($core['versions']);
     $sync->write('core.extension', $core);
     $sync->deleteAll('syslog.');
     $theme = $sync->read('system.theme');
diff --git a/core/modules/config/src/Tests/ConfigImportUITest.php b/core/modules/config/src/Tests/ConfigImportUITest.php
index 86d59ee..85529c1 100644
--- a/core/modules/config/src/Tests/ConfigImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigImportUITest.php
@@ -84,9 +84,14 @@ function testImport() {
     $core_extension['module']['action'] = 0;
     $core_extension['module']['ban'] = 0;
     $core_extension['module'] = module_config_sort($core_extension['module']);
+    $core_extension['versions']['action'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION, 'schema' => '8000'];
+    $core_extension['versions']['ban'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION, 'schema' => '8000'];
     // Bartik is a subtheme of classy so classy must be enabled.
     $core_extension['theme']['classy'] = 0;
     $core_extension['theme']['bartik'] = 0;
+    $core_extension['versions']['classy'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
+    $core_extension['versions']['bartik'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
+    ksort($core_extension['versions']);
     $sync->write('core.extension', $core_extension);
 
     // Use the install storage so that we can read configuration from modules
@@ -175,6 +180,11 @@ function testImport() {
     unset($core_extension['module']['options']);
     unset($core_extension['module']['text']);
     unset($core_extension['theme']['bartik']);
+    unset($core_extension['versions']['action']);
+    unset($core_extension['versions']['ban']);
+    unset($core_extension['versions']['options']);
+    unset($core_extension['versions']['text']);
+    unset($core_extension['versions']['bartik']);
     $sync->write('core.extension', $core_extension);
     $sync->delete('action.settings');
     $sync->delete('text.settings');
@@ -507,6 +517,16 @@ 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['versions']['ban'] = ['current' => '8.0.0-rc3', 'install' => '8.0.0-rc3', 'schema' => '8000'];
+    // This theme does exist but the version is wrong.
+    $core['theme']['seven'] = 0;
+    $core['versions']['seven'] = ['current' => '8.0.0-rc3', 'install' => '8.0.0-rc3'];
+    $core['versions']['bartik']['current'] = '8.0.0-rc3';
+    $core['versions']['text']['current'] = '8.0.0-rc3';
+    $core['versions']['config_test']['schema'] = '8999';
+
     $sync->write('core.extension', $core);
 
     $this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
@@ -515,6 +535,10 @@ 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 . ').');
+    $this->assertText('Unable to import configuration because the schema version of config_test module on the source site (8999) does not match this site (' . drupal_get_installed_schema_version('config_test') . ').');
+    $this->assertText('Unable to import configuration because the version of bartik theme on the source site (8.0.0-rc3) does not match this site (' . \Drupal::VERSION . ').');
   }
 
 }
diff --git a/core/modules/config/src/Tests/ConfigImporterTest.php b/core/modules/config/src/Tests/ConfigImporterTest.php
index 3fca8c0..1f5724d 100644
--- a/core/modules/config/src/Tests/ConfigImporterTest.php
+++ b/core/modules/config/src/Tests/ConfigImporterTest.php
@@ -578,6 +578,8 @@ public function testUnmetDependency() {
     // Add a module and a theme that depend on uninstalled extensions.
     $extensions['module']['book'] = 0;
     $extensions['theme']['bartik'] = 0;
+    $extensions['versions']['book'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
+    $extensions['versions']['bartik'] = ['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION];
 
     $sync->write('core.extension', $extensions);
     try {
@@ -649,6 +651,58 @@ public function testMissingCoreExtension() {
   }
 
   /**
+   * Tests missing core.extension:versions during configuration import.
+   *
+   * Configuration exported before the versions information was added should
+   * fail.
+   *
+   * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
+   */
+  public function testMissingVersionInformation() {
+    $sync = $this->container->get('config.storage.sync');
+    $data = $sync->read('core.extension');
+    unset($data['versions']);
+    $sync->write('core.extension', $data);
+    try {
+      $this->configImporter->reset()->import();
+      $this->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing version information.');
+    }
+    catch (ConfigImporterException $e) {
+      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.');
+      $error_log = $this->configImporter->getErrors();
+      $this->assertEqual(['The core.extension file is out-of-date. Update the codebase of the source site, run update.php and export the configuration again.'], $error_log);
+    }
+  }
+
+  /**
+   * Tests missing core.extension:versions during configuration import.
+   *
+   * Configuration exported before the versions information was added should
+   * fail.
+   *
+   * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
+   */
+  public function testVersionMismatch() {
+    $sync = $this->container->get('config.storage.sync');
+    $data = $sync->read('core.extension');
+    $data['versions']['system']['current'] = '8.0.0-beta1';
+    $data['versions']['config_test']['schema'] = '8999';
+    $sync->write('core.extension', $data);
+    try {
+      $this->configImporter->reset()->import();
+      $this->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing version information.');
+    }
+    catch (ConfigImporterException $e) {
+      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.');
+      $error_log = $this->configImporter->getErrors();
+      $this->assertEqual([
+        'Unable to import configuration because the schema version of <em class="placeholder">config_test</em> module on the source site (8999) does not match this site (-1).',
+        'Unable to import configuration because the version of <em class="placeholder">system</em> module on the source site (8.0.0-beta1) does not match this site (8.0.0-dev).'
+      ], $error_log);
+    }
+  }
+
+  /**
    * Tests install profile validation during configuration import.
    *
    * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 56c800e..3f686e7 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -236,7 +236,13 @@ protected function setUp() {
     // \Drupal\Core\Config\ConfigInstaller::installDefaultConfig() to work.
     // Write directly to active storage to avoid early instantiation of
     // the event dispatcher which can prevent modules from registering events.
-    \Drupal::service('config.storage')->write('core.extension', array('module' => array(), 'theme' => array()));
+    \Drupal::service('config.storage')->write('core.extension',
+      [
+        'module' => [],
+        'theme' => [],
+        'versions' => [],
+      ]
+    );
 
     // Collect and set a fixed module list.
     $class = get_class($this);
@@ -511,6 +517,13 @@ protected function enableModules(array $modules) {
       $module_handler->addModule($module, $module_list[$module]->getPath());
       // Maintain the list of enabled modules in configuration.
       $extensions['module'][$module] = 0;
+      $version = \Drupal::service('info_parser')->parse($module_list[$module]->getPathname())['version'];
+      $extensions['versions'][$module] = [
+        'current' => $version,
+        'install' => $version,
+        // @todo How to get schema - or should installSchema do this?
+        'schema' => SCHEMA_UNINSTALLED,
+      ];
     }
     $active_storage->write('core.extension', $extensions);
 
diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
index ae3742e..83135f6 100644
--- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
+++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
@@ -334,6 +334,18 @@ public function testDrupalGetProfile() {
   }
 
   /**
+   * @covers ::enableModules
+   */
+  public function testEnableModules() {
+    $this->assertFalse(\Drupal::moduleHandler()->moduleExists('system'));
+    $this->enableModules(['system', 'user']);
+    $core = \Drupal::config('core.extension');
+    $this->assertEqual(['entity_test' => 0, 'user' => 0, 'system' => 0], $core->get('module'));
+    $this->assertEqual(['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION, 'schema' => NULL], $core->get('versions.user'));
+    $this->assertTrue(\Drupal::moduleHandler()->moduleExists('system'));
+  }
+
+  /**
    * {@inheritdoc}
    */
   public function run(array $methods = array()) {
diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php
index 0239a41..c865675 100644
--- a/core/modules/system/src/Controller/DbUpdateController.php
+++ b/core/modules/system/src/Controller/DbUpdateController.php
@@ -653,6 +653,17 @@ public static function batchFinished($success, $results, $operations) {
     // No updates to run, so caches won't get flushed later.  Clear them now.
     drupal_flush_all_caches();
 
+    // Update core.extensions to have the correct version information.
+    $core = \Drupal::configFactory()->getEditable('core.extension');
+    foreach (\Drupal::moduleHandler()->getModuleList() as $module => $extension) {
+      $version = \Drupal::service('info_parser')->parse($extension->getPathname())['version'];
+      $core->set("versions.$module.current", $version);
+    }
+    foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $extension) {
+      $version = \Drupal::service('info_parser')->parse($extension->getPathname())['version'];
+      $core->set("versions.$theme.current", $version);
+    }
+
     $_SESSION['update_results'] = $results;
     $_SESSION['update_success'] = $success;
     $_SESSION['updates_remaining'] = $operations;
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index afa5892..1bb80d1 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1871,3 +1871,29 @@ function system_update_8014() {
 /**
  * @} End of "addtogroup updates-8.0.0-rc".
  */
+
+/**
+ * Add the version information to core.extension
+ */
+function system_update_8015() {
+  // Update core.extensions to have the correct version information.
+  $core = \Drupal::configFactory()->getEditable('core.extension');
+  $versions = $core->get('versions');
+  foreach (\Drupal::moduleHandler()->getModuleList() as $module => $extension) {
+    $version = \Drupal::service('info_parser')->parse($extension->getPathname())['version'];
+    $versions[$module] = [
+      'current' => $version,
+      'install' => $version,
+      'schema' => (string) drupal_get_installed_schema_version($module),
+    ];
+  }
+  foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $extension) {
+    $version = \Drupal::service('info_parser')->parse($extension->getPathname())['version'];
+    $versions[$theme] = [
+      'current' => $version,
+      'install' => $version,
+    ];
+  }
+  ksort($versions);
+  $core->set('versions', $versions)->save();
+}
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index fd7b864..0149613 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -830,6 +830,13 @@ protected function enableModules(array $modules) {
       $module_handler->addModule($module, $module_list[$module]->getPath());
       // Maintain the list of enabled modules in configuration.
       $extension_config['module'][$module] = 0;
+      $version = \Drupal::service('info_parser')->parse($module_list[$module]->getPathname())['version'];
+      $extension_config['versions'][$module] = [
+        'current' => $version,
+        'install' => $version,
+        // @todo How to get schema - or should installSchema do this?
+        'schema' => SCHEMA_UNINSTALLED,
+      ];
     }
     $active_storage->write('core.extension', $extension_config);
 
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
index 188d111..d3e30db 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
@@ -211,6 +211,18 @@ public function testRenderWithTheme() {
   }
 
   /**
+   * @covers ::enableModules
+   */
+  public function testEnableModules() {
+    $this->assertFalse(\Drupal::moduleHandler()->moduleExists('system'));
+    $this->enableModules(['system', 'user']);
+    $core = \Drupal::config('core.extension');
+    $this->assertEquals(['user' => 0, 'system' => 0], $core->get('module'));
+    $this->assertEquals(['current' => \Drupal::VERSION, 'install' => \Drupal::VERSION, 'schema' => NULL], $core->get('versions.user'));
+    $this->assertTrue(\Drupal::moduleHandler()->moduleExists('system'));
+  }
+
+  /**
    * {@inheritdoc}
    */
   protected function tearDown() {
diff --git a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php
index e65c651..62377c2 100644
--- a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php
@@ -32,6 +32,7 @@ public function testConfigIsEmpty() {
     $expected = array(
       'module' => array(),
       'theme' => array(),
+      'versions' => array(),
     );
     $this->assertEquals($expected, $config);
   }
