找不到文件“~/controls/labelcontrol.ascx”

file '~/controls/labelcontrol.ascx" was not found

我对 visual studio 和 dnn 很陌生,我正在通过一本书学习 "basics"。我正在尝试构建我的第一个模块。在 ascx 文件之一中,我有以下代码:

<%@ Control Language="C#" AutoEventWireup ="true" CodeBehind="Settings.ascx.cs" Inherits="wrox.Modules.guestbook.Settings" %>
<%@ Register TagName="label" TagPrefix="dnn" Src="~/controls/labelcontrol.ascx" %>

<fieldset>
    <div class="dnnFormItem">
        <dnn:Label ID="lblAutoApprove" runat="server" ResourceKey="lblAutoApprove"
            ControlName="chkAutoApprove" />
    </div>
</fieldset>


<asp:CheckBox runat="server" ID="chkAutoApprove" />

下面的一段代码给出了以下警告:file '~/controls/labelcontrol.ascx" was not found

<%@ Register TagName="label" TagPrefix="dnn" Src="~/controls/labelcontrol.ascx" %>

我需要为这段代码使用labecontrol.ascx文件。

<div class="dnnFormItem">
    <dnn:Label ID="lblAutoApprove" runat="server" 
      ResourceKey="lblAutoApprove"
        ControlName="chkAutoApprove" />
</div>

这段代码给出以下警告,因为 labecontrol.ascx 文件丢失(据我所知):Element 'Label' 不是已知元素。如果网站中存在编译错误,或者缺少 web.config 文件,就会发生这种情况。

我在这个网站上发现了两个类似的问题。 The first one 不是很有帮助,因为答案是忽略警告。我不想这样做。 The second question 也没有帮助,因为 he/she 有错字。

我怎样才能摆脱这个警告?

备注: 我正在使用 visual studio 2017 和 dotnetnuke 8

自从我完成 DNN 开发以来已经有一段时间了,但问题通常是当您制作自定义模块时,您在 DNN 的其余部分存在的上下文中进行制作,但在 develop-time ,DNN 的其余部分实际上并不存在(或者至少不在 Visual Studio 期望找到它的地方)。

我认为您可以通过将 DNN 标签控件复制到模块的控件文件夹中来消除警告。如果你这样做,我会确保你的构建不包含 DNN 控件,并且你将它放在你的源代码管理使用的任何忽略列表中。