views:

60

answers:

2

I've converted a SiteFinity (C#) app from a Website to a WebApplicationProject. It all works great..except

I used to have in my App_Code a class called MaterialsModule which inherits from the base class WebModule.

Problem: SiteFinity doesn't automagically see this class any more

I've tried adding a namespace to the class and adding it to the code behind here (which is the page where I'm expecting this MaterialModule page to show)

http://localhost/fmwebapp1/Sitefinity/Admin/Modules.aspx

public class MaterialsModule : WebModule
{
    public MaterialsModule()
    {
    }

    public override IList<Telerik.Web.IToolboxItem> Controls
    {
        get
        {
            return new List<IToolboxItem>(
                new ToolboxItem[]
                {
                    new CmsToolboxItem("~/Custom/Modules/Materials/Frontend/Controls/MaterialsList.ascx", "Materials", "Materials List", "Displays list of all materials")
                });
        } 
    }

    public override string Description
    {
        get { return "This is the Materials Module"; }
    }

    public override string Name
    {
        get { return "Materials"; }
    }

    public override string Title
    {
        get { return "Materials"; }
    }

    public override System.Web.UI.Control CreateControlPanel(System.Web.UI.TemplateControl parent)
    {
        return new MaterialsControlPanel();
    }
A: 

You could try deleting the page.aspx.designer.vb file, then right-click the page.aspx and select "Convert to Web Application" to re-create the designer file. Of course, this assumes the problem is with that file.

ironsam
Thanks ironsam - the .designer looks fine.. I've redone it just to see :-) Also tried bringing in all my files into the same directory as the rendering page.aspx.. no luck yet...
Dave
So when you reference `MaterialsModule` in the `page.aspx`, it won't compile? You could try removing the namespace for it or adding the namespace to the project's imported namespace (in the project settings).
ironsam
A: 

In a web site project all assemblies in the ~/bin folder automatically get added to the GAC.

In a web application project, you need to explicitly define which assemblies are included in the GAC.

--

I believe you can fix this by adding Sitefinity's assembly references to your project.

To do this:

  1. Rght-click your project in the Solution Explorer
  2. Click Add References
  3. Browse for assemblies
  4. Navigate to the Sitefinity ~/bin folder
  5. Add references to the Sitefinity DLL files

WebModule should then be recognized as a defined class.

--

Good news, Sitefinity 4.0 (later this year) supports Web Application projects by default.

Gabe