Visual Studio 2022 - 操作未成功完成,因为文件包含病毒或可能不需要的软件

Visual Studio 2022 - Operation did not complete successfully because the file contains a virus or potentially unwanted software

当我在 Visual Studio 2022 年调试 Blazor 应用程序时出现此错误:

Failed to launch debug adapter. Additional information may be available in the output window.

Operation did not complete successfully because the file contains a virus or potentially unwanted software

调试MVC项目时没有出现该错误。

您编译的可执行文件被防病毒软件阻止,因此 Windows 无法 运行 或调试它。

理想的解决方案是完全卸载导致问题的防病毒软件,您的程序将运行 不受干扰。您也可以在更改任何内容之前暂时禁用它进行测试。

如果你真的想在安装防病毒软件的同时进行开发,你可以给它添加一个例外,让运行你的程序(通常整个项目文件夹都可以,但是编译后的可执行文件是您需要从分析中排除的最低限度)。