Resharper 如何获知框架版本?
我正在使用 Resharper 4.5.1 在 VS2008 中进行编码,但项目设置为针对 .NET Framework 2.0。
尽管如此,Resharper 仍在提出与 .NET 3.5 框架相关的建议。例如,它告诉我应该使用集合初始值设定项等...
我查看了设置,但似乎找不到复选框来告诉它提供 2.0 具体建议。
I am coding in VS2008 with Resharper 4.5.1, but the projects are set to target .NET Framework 2.0.
Still, Resharper is making suggestions that are relevant to the .NET 3.5 framework. For instance, it tells me that I should be using collection initializers, etc...
I've looked through the settings and can't seem to find the checkbox to tell it to give 2.0 specific advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在解决方案资源管理器中选择您的项目,然后打开“属性”工具窗口(标准键盘布局中的 F4 或选择项目后的“查看 > 属性窗口”)。在 ReSharper 部分中,有一个语言级别属性,您可以将其设置为 C# 2.0。请注意,有两个单独的项目属性窗口管理不同的属性,如果您看到“应用程序”、“构建”和“调试”选项卡,则说明您位于错误的窗口中。
正如其他人所说,这会影响 C# 的版本,而不是框架的版本(因为大多数 C# 3.0 更改都可以编译为面向 .NET 2.0 的程序集)。
Select your project in the Solution Explorer and open the Properties tool window (F4 in the standard keyboard layout or View > Properties Window after selecting the project). In the ReSharper section, there is a Language Level property that you can set to C# 2.0. Note that there are two separate project properties windows that manage different properties, if you see tabs for "Application", "Build" and "Debug" you are in the wrong window.
As others have said, this affects the version of C#, not the version of the framework (since most of the C# 3.0 changes can be compiled to an assembly that targets .NET 2.0).
这些功能不是 .NET 3.5 框架功能,而仅仅是 3.5 编译器的功能。由于在 VS2008 中这是为 .NET 2 目标调用的编译器,因此它确实可以正确处理这些语法扩展。
Those features are not .NET 3.5 framework features, but merely features of the 3.5 compiler. And since in VS2008 this is the compiler invoked for .NET 2 targets, it does handle these syntax extensions correctly.