警告错误 - 如何摆脱这些 [英] Warning as error - How to get rid of these

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

问题描述

我不知道如何消除在 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.

例如,我收到以下错误:

For example, I'm getting the following error:

错误 1 ​​警告为错误:XML 注释在'ScrewTurn.Wiki.SearchEngine.Relevance.Finalize(float)'有一个IsFinalized"的 paramref 标签,但该名称没有参数C:\www\Wiki\Screwturn3_0_2_509\SearchEngine\Relevance.cs60 70 搜索引擎

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天全站免登陆