<!DOCTYPE html> - 文档类型声明只能出现一次

Sam*_*tar 11 html visual-studio angularjs visual-studio-2013

我的代码看起来像这样:

<!DOCTYPE html>
<html lang="en"
      class="light"
      ng-app="app"
      ng-controller="appController"
      id="ngApp"
      xmlns:ng="http://angularjs.org"
      xmlns:ui="ui-router">
Run Code Online (Sandbox Code Playgroud)

在Visual Studio 2013中,这总是在编辑器中出现问题,DOCTYPE以绿色下划线,并显示一条消息:

Document Type Declaration must appear only once
Run Code Online (Sandbox Code Playgroud)

有没有其他人找到解决这个问题的方法.请注意,这很简单,<html>这不会发生.代码在浏览器中工作,但对于VS2013 Update 1-4的所有版本,我在DOCTYPE下看到这条绿色波浪线.

the*_*ton 4

检查一下是否有布局文件。如果您使用 Visual Studio 提供的 MVC 模板,那么您的布局文件将位于Views/Shared/_Layout. 在那里你可以看到<!DOCTYPE html>已经插入了。

  • 我在调试时在 Visual Studio 2015 中看到了这个。当我结束调试器时它就消失了。大概是因为它同时打开了两个主页副本 (2认同)