Magento – Cannot read contents from file app\design\adminhtml\Magento\backend\etc\module.xml in Magento 2

backenddesignmagento2theme

I have created a adminhtml theme but it's throwing error. Could you please clarify me where I went wrong?

my code is:

root/app/design/adminhtml/Magento/backend/composer.json

{
    "name": "magento/theme-adminhtml-backend",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/framework": "100.0.*"
    },
    "type": "magento2-theme",
    "version": "100.0.2",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
                 "files": [
             "registration.php"
         ]
     }

}

root/app/design/adminhtml/Magento/backend/registration.php

<?php
    /**
     * Copyright © 2015 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */

\Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::MODULE,
        'adminhtml/Magento/backend',
        __DIR__
    );

root/app/design/adminhtml/Magento/backend/theme.xml

<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Magento 2 backend</title>
</theme>

Could you please clarify me where I went wrong?

Best Answer

Your registration.php file has declared the wrong type; You need to change it to;

\Magento\Framework\Component\ComponentRegistrar::THEME

Because you have declared it as ::MODULE it is looking for the module.xml definition.