“删除不必要的使用"在 Visual Studio 2015 中不起作用 [英] "Remove unnecessary usings" not working in Visual Studio 2015

查看:37
本文介绍了“删除不必要的使用"在 Visual Studio 2015 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个项目的解决方案.删除不必要的使用 在除一个之外的所有项目中都有效.

I have a solution with a few projects. Remove unnecessary usings is working in all projects except for one.

为什么删除不必要的使用命令在某些项目中不起作用?

Why does the Remove unnecessary usings command not work in some projects?

编辑 - 正如您在 Before 图像中看到的,没有 Remove不必要的使用 命令,如果您尝试右键单击文件,然后组织使用>删除不必要的使用 什么都不做.将项目构建警告级别设置为 4 后,Remove不必要的使用 命令出现并起作用.

Edit - As you can see in the Before image there is no Remove unnecessary usings command and if you try to right-click in the file, then Organize usings > Remove unnecessary usings does nothing. After setting the project build warning level to 4 the Remove unnecessary usings command appears and works.

之前:

之后:

推荐答案

project propertiesBuild 部分,有一个名为 Errors and warnings 的设置 应该是 4.

In the Build section of the project properties there is a setting called Errors and warnings which should be 4.

这篇关于“删除不必要的使用"在 Visual Studio 2015 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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