我有一个在Visual Studio 2008中构建的C#Web应用程序,我们在很大程度上依赖于"预构建"的ASP.NET块的用户控件.
我们不是在每个页面上注册大量用户控件,而是在本地(到特定文件夹)web.config文件中注册所有控件.优点是我们可以使用控件,并且页面在源视图中看起来"更干净".但是,VS2008设计视图和智能感知都无法识别控件的注册事实web.config.但是,应用程序本身按预期工作.
通常在每个页面的顶部我们都有这样的标签:
<%@ Register src="~/CommonControls/Foo.ascx" tagname="Foo" tagprefix="Bar" %>
Run Code Online (Sandbox Code Playgroud)
我们在本地web.config中注册控件,如下所示:
<?xml version="1.0"?>
<configuration>
<system.web>
<pages>
<controls>
<add src="~/CommonControls/Foo.ascx" tagName="Foo" tagPrefix="Bar"/>
</controls>
</pages>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
有没有人知道让Intellisense识别这些自定义控件的修复程序?或者,有一种"更好"的方式吗?