用类库项目做了个自定义控件
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
using System.Web.UI.Design;
namespace TextBoxControl
{
[Designer(typeof(AutoFormatTextBoxDesigner))]
public class AutoFormatTextBox:TextBox
{
}
[SupportsPreviewControl(true)]
public class AutoFormatTextBoxDesigner : ControlDesigner
{
static DesignerAutoFormatCollection _autoFormats;
public override DesignerAutoFormatCollection AutoFormats
{
编译时提示找不到 TextBox,找了半天才知道原来类库项目中虽然using System.Web.UI.WebControls;但是不能自动引入需要的DLL,所以需要手动引入,具体方法如下:
其实在做控件开发时好多情况需要引入DLL,我不知道为什么在ASP.NET中能自动引入在类库项目中为什么不可以,希望知道的告诉我下,谢谢!