警告为错误-如何消除这些 [英] Warning as error - How to rid these

查看:142
本文介绍了警告为错误-如何消除这些的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual 中,我无法弄清楚如何消除基本上不应该停止编译的错误; Studio  2010 ,并且不应该成为障碍物,否则至少我以后会修复它们,但我不希望编译器仅对此类问题进行错误处理并停止运行.

I cannot figure out how to get rid of errors that basically should not be halting my compile in Visual Studio 2010 and should not be show stoppers, or at least I will fix them later, but I don't want the compile to just error and halt on these kinds of problems.

例如,出现以下错误:

错误1警告为错误:XML注释 在 'ScrewTurn.Wiki.SearchEngine.Relevance.Finalize(float)' 有一个针对"IsFinalized"的paramref标签, 但是这个名字没有参数 C:\ www \ Wiki \ Screwturn3_0_2_509 \ SearchEngine \ Relevance.cs 60 70 SearchEngine

Error 1 Warning as Error: XML comment on 'ScrewTurn.Wiki.SearchEngine.Relevance.Finalize(float)' has a paramref tag for 'IsFinalized', but there is no parameter by that name C:\www\Wiki\Screwturn3_0_2_509\SearchEngine\Relevance.cs 60 70 SearchEngine

此代码:

  /// <summary>
  /// Normalizes the relevance after finalization.
  /// </summary>
  /// <param name="factor">The normalization factor.</param>
  /// <exception cref="InvalidOperationException">If <paramref name="IsFinalized"/> is <c>false</c> (<see cref="M:Finalize"/> was not called).</exception>
  public void NormalizeAfterFinalization(float factor) {
      if (factor < 0)
          throw new ArgumentOutOfRangeException("factor", "Factor must be greater than or equal to zero");

      if (!isFinalized)
          throw new InvalidOperationException("Normalization can be performed only after finalization");
      value = value * factor;
  }

我查看了菜单 Tools -> Options ,但看不到可以调整编译器的位置,并告诉它不要担心基于注释或基于XHTML的错误

I looked in menu Tools -> Options, and I don't see where I can tweak the compiler and tell it not to worry about comment or XHTML based errors.

推荐答案

Visual Studio中的每个项目都有一个将警告视为错误"选项.遍历每个项目并更改该设置:

Each project in Visual Studio has a "treat warnings as errors" option. Go through each of your projects and change that setting:

  1. 右键单击您的项目,选择属性".
  2. 点击构建".
  3. 将将警告作为错误处理"从全部"切换为特定警告"或无".

此开关的位置因项目类型(例如,类库与Web应用程序)而异.

The location of this switch varies, depending on the type of project (class library vs. web application, for example).

这篇关于警告为错误-如何消除这些的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆