问题描述
在 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.
例如,出现以下错误:
此代码:
/// <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:
- 右键单击您的项目,选择属性".
- 点击构建".
- 将将警告作为错误处理"从全部"切换为特定警告"或无".
此开关的位置因项目类型(例如,类库与Web应用程序)而异.
The location of this switch varies, depending on the type of project (class library vs. web application, for example).
这篇关于警告为错误-如何消除这些的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!