Windows 服务:托管兼容模式不支持编辑并继续

Windows Service: Managed Compatibility Mode does not support Edit and Continue

我被分配到 Windows 服务项目。我使用安装程序 class (ProjectInstaller.cs) 在我的机器上安装了它。我想调试源代码,有时需要在调试模式下进行更改。我通过“调试”菜单附加了该过程以调试工作正常但在我尝试编辑或继续源代码时抛出错误的项目:

托管兼容模式不支持编辑并继续

我用谷歌搜索并尝试了很多解决方案,但 none 对我有用,其中几个如下:

错误消息因我实施的不同解决方案而异。

下面是我上次试过的 link:

https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013/

我猜:最后一个没有用,因为我没有用于我的服务的 exe 项目,而是我实现了 ProjectInstaller.cs Class 并通过命令提示符手动安装它。

欢迎任何suggestion/recommendation。

“编辑并继续”需要许多用户不明显的因素。根本不支持您的案例(主要用于附加案例)。

请参阅 MSDN 中的 Supported Code Changes (C#)。特别是:

Edit and Continue is not available in the following debugging scenarios: [...]

Debugging an application that has Attach to instead of running the application by choosing Start from the Debug menu.

为每次调试附加我的过程让我很头疼。

只是想分享一个 link 通过编写一个简单的方法并在 Main() 方法中调用它来节省我很多时间的方法 Program.cs.

这也让我可以灵活地编辑和继续我的代码,就像 WinForm / Web Form 一样简单。喜欢它。

https://coding.abel.nu/2012/05/debugging-a-windows-service-project/

我重置了VISUAL STUDIO设置,问题解决了 希望对你有帮助to Reset visual studio setting

Unckeck 使用托管兼容模式,它对我有用!并且您必须在调试常规

中启用编辑并继续