简体   繁体   English

Visual Studio 无法识别新添加的 class

[英]Visual studio does not recognize newly added class

I am having a weird issue here, i am using vs 2019 and one of my projects refuses to recognize any newly added c# classes, i can not use it anywhere else in the project.我在这里遇到了一个奇怪的问题,我正在使用 vs 2019 并且我的一个项目拒绝识别任何新添加的 c# 类,我无法在项目的其他任何地方使用它。 This is just an empty class.这只是一个空的 class。 The new class has no little triangle to the left of it too.新的 class 左侧也没有小三角形。

附图

I have tried clean and rebuild this project and did not help, my other projects in the same solution do not have this problem, i am thinking probably i messed up with something in this mvc project but not sure.我已经尝试清理并重建这个项目并没有帮助,我在同一解决方案中的其他项目没有这个问题,我想我可能在这个 mvc 项目中搞砸了一些东西,但不确定。

this is very frustrating, any help is very much appreciated.这非常令人沮丧,非常感谢任何帮助。


I have fixed this by updating Microsoft.Net.Compilers from 1.0.0 to 3.5.0, and then as its description suggested, use Microsoft.Net.Compilers.Toolset.3.5.0 instead.我已通过将 Microsoft.Net.Compilers 从 1.0.0 更新到 3.5.0 来解决此问题,然后按照其描述建议,改用 Microsoft.Net.Compilers.Toolset.3.5.0。

I am not sure i completely understand, but seems the problem is that this project uses Microsoft.Net.Compilers instead of MSBuild and the package is out dated.我不确定我是否完全理解,但似乎问题在于该项目使用 Microsoft.Net.Compilers 而不是 MSBuild 并且 package 已过时。

I have fixed this by updating Microsoft.Net.Compilers from 1.0.0 to 3.5.0, and then as its description suggested, use Microsoft.Net.Compilers.Toolset.3.5.0 instead.我已通过将 Microsoft.Net.Compilers 从 1.0.0 更新到 3.5.0 来解决此问题,然后按照其描述建议,改用 Microsoft.Net.Compilers.Toolset.3.5.0。

I am not sure i completely understand, but seems the problem is that this project uses Microsoft.Net.Compilers instead of MSBuild and the package is out dated.我不确定我是否完全理解,但似乎问题在于该项目使用 Microsoft.Net.Compilers 而不是 MSBuild 并且 package 已过时。

This solve the issue: update the package Microsoft.Net.Compiler to the latest version, compile and try adding a new class to your project again.这解决了问题:将 package Microsoft.Net.Compiler 更新到最新版本,编译并尝试再次将新的 class 添加到您的项目中。

In your screen clip, note the lack of the triangle to expand the member list.在您的屏幕剪辑中,请注意缺少用于展开成员列表的三角形。 This likely means your code isn't being compiled.这可能意味着您的代码没有被编译。 Right click on the cs file and check properties/build action.右键单击 cs 文件并检查属性/构建操作。 Set to "compile" if it's not already.如果还没有,请设置为“编译”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio无法识别MvxFragment的BindingInflate函数 - Visual Studio does not recognize BindingInflate function of MvxFragment Visual Studio无法识别System.Linq - Visual Studio Does not recognize System.Linq Visual Studio不存在于命名空间中,但添加了引用 - Visual studio does not exist in the namespace, but reference is added 为什么 Visual Studio 将新创建的数组键入为 Nullable? - Why does Visual Studio Type a Newly Minted Array as Nullable? Visual Studio无法识别我班上的函数 - Visual Studio doesn't recognize functions in my class visual studio无法识别版本10.0.14393.0中的Windows 10 sdk - visual studio does not recognize windows 10 sdk in version 10.0.14393.0 Visual Studio 2019:Intellisense 无法识别引用的程序集 - Visual Studio 2019: Intellisense does not recognize assemblies as referenced Visual Studio无法识别WPF中数据绑定的正确类型 - Visual studio does not recognize the correct type for data binding in WPF Visual Studio中devexpress的ReportViewer控件无法识别LocalReport属性 - ReportViewer control of devexpress in visual studio that does not recognize the LocalReport property Visual Studio 2015无法识别OTF转换的字体(UWP) - Visual Studio 2015 does not recognize OTF converted fonts (UWP)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM