在一个项目上,我在一个属性上做了一堂课,当我尝试自动生成一类构造函数时,我会在“自动生成类构造函数失败...并将被禁用”的行中,却觉得有任何感觉。 “生成构造函数”选项已从重构菜单中取出,最重要的是,我不会再突出显示语法错误,而IntelliSense似乎无法正常工作或根本无法正常工作。
我尝试使用工具>选项>文本编辑> 各种字段,包括“ C#”和“ General” ),我看不到任何明显错误的领域。我还尝试使用Visual Studio安装程序尝试维修,但无能为力。我完全没有想法,我找不到任何与我的案子遥不可及的东西。 tia
Working on a project I made a class with properties and when I tried to auto-generate a class constructor I got an error saying something on lines of "auto generation of class constructor failed... and will be disabled" and ever sense then the "generate constructor" option has been taken off the Refactor menu and on top of that I don't get syntax error highlighting anymore and intellisense doesn't seem to be working proper or at all.
I tried using going into Tools > Options > Text Editor > various fields including "C#" and "general") and I don't see anything obviously wrong. I also tried to use Visual Studio Installer to try to repair and that didn't do anything. I am completely out of ideas and I can't find anything that is remotely close to my case. TIA
发布评论
评论(9)
我无法将此答复添加为评论,因为我没有50个声誉。
我在Visual Studio 2022中创建了一个.NET 6.0 C#控制台项目,添加一个类,并添加两个私有字段。选择这两个字段,按Alt+Enter快速生成构造函数。我没有遇到你的问题。
请尝试:
修改
,unableIntellicode
in 单个组件,然后单击修改
按钮以保存更改,等待安装完成,然后重新安装Intellicode
。I can't add this reply as a comment as I don't have 50 reputation.
I created a .Net 6.0 C# console project in Visual Studio 2022, add a class, and add two private fields. Selecting these two fields, press Alt+Enter to quickly generate the constructor. I did not encounter your issue.
Please try:
Modify
, uncheckIntelliCode
in Individual components, then clickModify
button to save the change, wait for the installation to complete, and then reinstallIntelliCode
.试用版,则可能会发生
。
从左侧栏 - >导航到安装。
从右侧寻找“ 喷气桥resharper ...”并禁用它。
关闭对话框。
关闭所有Visual Studio打开Windows。
再次打开您的项目之一。
导航到工具菜单 - > 选项。
从左侧 - > 文本编辑。
对于C#开发人员 - > 导航到C# - >
in 一般 - > 取消选中“自动列表成员”,然后再次检查。
in Intellisense - > 检查/(请取消选中并再次检查它们)以下内容:
“显示字符后显示完成列表”
“自动展示完成....”
“亮点..”
“显示完成项目过滤器”
“显示名称建议”
请参阅以下屏幕截图
我希望它有帮助。
This might happen If you use the ReSharper extension trial version and it is expired.
To fix this:
Navigate to Extensions menu-> Manage Extensions in visual studio.
From the left side bar -> navigate to installed.
From the right side look for "JetBrains Resharper ..." and disable it.
Close the dialog.
Close all Visual studio opened windows.
Open one of your project again.
Navigate to Tools menu-> option.
From the left side -> Text Editor.
For C# developers -> Navigate to C# ->
In General -> Uncheck "Auto list members" and check it again.
In intelliSense -> check/ (uncheck and check them again if it is already checked) the following:
"Show completion list after a character is typed"
"Automaticall show completion ...."
"Highlight .."
"Show completion item filter"
"Show name suggestions"
Refer to the following screenshots
I hope it help.
工具/导入和导出设置/重置所有设置
此过程对我有用
Tools/Import and export settings/Reset all settings
this procedure worked for me
我遇到了同样的问题,我尝试了多个解决方案,什么也没有奏效,最后我发现此问题的原因是我在Visual Studio中打开了“文件夹”文件,而不是“ SLN”文件。因此,仅打开“ SLN”文件就可以解决该问题。
i had same issue , i tried multiple solution, nothing worked and i finally i found that the reason for this issue is i was opened 'folder' file in visual studio instead of 'Sln' file. so simply opening of 'Sln' file will solve the issue.
转到工具菜单,然后选择选项。在Intellicode下,Select General。只是取消选中“ C#建议”。然后重新启动Visual Studio并检查是否出现智能和语法错误。
请注意,我无法弄清楚此选项的作用,因为C#代码建议似乎继续按预期工作。
Go to Tools menu, and select Options. Under Intellicode select General. Just uncheck “C# Suggestions”. Then restart Visual Studio and check that intellisence and syntax errors are appearing.
Note, I was not able to figure out what this option does, as the C# code suggestions seemed to continue to work as expected.
添加此功能是因为我是通过Google来到这里的,这比重新安装Intellisense和Visual Studio的核动作要少。
检查工具>选项...>文本编辑>一般的。就我而言,我没有选中“显示错误”,并且忘记了我这样做了。
Adding this because I came here via google and this is a less nuclear action to take than reinstalling intellisense and Visual Studio.
Check Tools > Options... > Text Editor > General. In my case I had unchecked "Show error squiggles" and had forgotten I had done this.
在Visual Studio 2022中添加控制器时, 我遇到了类似的问题。控制器。
删除
&lt; compile remove =“控制器\ ...” /&gt; < /code>修复了Intellisense。
I got a similar problem while adding a controller in Visual Studio 2022. The
.csproj
file had the followingCompile.Remove
entry after adding the controller.Deleting
<Compile Remove="Controllers\..." />
fixed the intellisense.对我有用的唯一一件事是:
The only thing that worked for me was:
步骤1-卸载Visual Studio
步骤2-升级到Windows 11
步骤3-安装Visual Studio
对我有用
step 1 - uninstall visual studio
step 2 - upgrade to windows 11
step 3 - install visual studio
this works for me