Search code examples
dotnetnukedotnetnuke-7

Could not load type error - DNN Module Development


I saw you answered a question for another user for a similar issue and was hoping you could help.

I'm trying to build a settings page for my module.....the module actually works ok, its just when I added a new settings ascx page I started having problems.

My code behind on the settings page

using System;
using DotNetNuke.Entities.Modules;

namespace Ukiset.Registration
{
    public partial class Settings : ModuleSettingsBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public override void LoadSettings()
        {
            base.LoadSettings();
        }

        public override void UpdateSettings()
        {
            base.UpdateSettings();
        }
    }
}

My design view on settings.ascx

<%@ Control Language="C#" AutoEventWireup="true"   CodeBehind="Settings.ascx.cs" Inherits="Ukiset.Registration.Settings" %>

This is what i'm getting from the event viewer when it throws an error

<pre>
    AbsoluteURL:/Default.aspx
    DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
    ExceptionGUID:d1050063-f221-43ad-8118-571e7d9818a4
    AssemblyVersion:
    PortalId:-1
    UserId:-1
    TabId:-1
    RawUrl:
    Referrer:
    UserAgent:
    ExceptionHash:SOKwQeZDhciTuPHTIxGH0w==
    Message:Could not load type 'MySite.Registration.Settings'.
    StackTrace:
</pre>

in my build output path I have pointed it to C:\DNN\MyDNNSite\bin\ yet it still throws this problem, can you help?


Solution

  • Your problem appears to be a Namespace issue.

    MySite.Registration.Settings

    vs

    Ukiset.Registration.Settings

    Do you have "MySite" anywhere in your project? Perhaps you've got an ASCX file that still points to MySite.Registration.Settings instead of Ukiset.Registration.Settings?

    Is your development solution/project inside of C:\DNN\MyDNNSite\DesktopModules\ ?

    As for the BIN folder, after you compile, are you getting the DLL in the c:\dnn\mydnnsite\bin folder?