I’ve got two files in the same directory, an ascx file and an ascx.cs file with a C# class defined inside of it.
This is the code in my .ascx file
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test.ascx.cs"
Inherits="SITE.UI.Controls.Test" %>
And this is the code in Test.ascx.cs:
using System;
using System.Web.UI;
namespace SITE.UI.Controls
{
public partial class Test : System.Web.UI.UserControl
{
}
}
However whenever I try and build the site I always get this error:
Error 1 Could not load type ‘SITE.UI.Controls.Test’
I’m sure I must be doing something obviously wrong but after over an hour of thrashing I’m getting nowhere . . .
Go into the Web Project properties -> Build settings and change the Output Path to bin\
If that don’t work, check this post. Here are a lot of solutions for this problem.
Let me know it when it’s fixed or not 🙂