2

I've just added a new UserControl to a project of user controls. I'm just using the default generated code without any editing. When I try to place the UserControl on a test page in a separate project, intellisense shows all of the user controls in my assembly except the one I just added. If I type the name of the user control it says it is not a known element. I've tried restarting VS, cleaning, and rebuilding in all different orders. How do I make VS recognize the user control?

ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="CustomControls2.WebUserControl1" %>

ascx.cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace CustomControls2
{
    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

Test Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage2.aspx.cs" Inherits="TestDriver.TestPage2" %>
<%@ Register Assembly="CustomControls2" Namespace="CustomControls2" TagPrefix="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <Test:WebUserControl1 id="asdf" runat="server" />
    </div>
    </form>
</body>
</html>
xr280xr
  • 12,621
  • 7
  • 81
  • 125
  • are you developing against iis or casinni (the vs dev server)? Sometime, esp with iis, you need to restart iis and clear the asp.net temp files. This allows dynamic compilation to resume. This sort of behavior in my experience usually has something to do with compilation (the compilation that happens separate from compiling the main dll) – MatthewMartin Nov 19 '12 at 22:50
  • Thanks for your reply. I haven't even run it yet. This is all in VS 2008 at design time. – xr280xr Nov 19 '12 at 23:47

0 Answers0