我对 OS X 很陌生(我的新 mac 用了 4 天),我正在建立一个环境,我可以使用 Visual Studio Code 中内置的调试器在本地调试我的 Asp.Net 5 Web 项目,特别是获取附加到单声道时断点工作。
我按照这些说明安装了 asp.net 5 和 Visual Studio 代码。( http://docs.asp.net/en/latest/getting-started/installing-on-mac.html )
然后我安装了 yeoman,并搭建了一个 aspnet 项目。
我运行了命令dnu restore
、dnu build
和dnx web
。
该项目在 localhost:5000 的 Kestrel 上本地运行就好了。我还可以通过 VS Code 调试器将它附加到单声道。
当我尝试在 C# 代码中设置断点时,就会出现问题。调试器不会命中它们。
在做了一些研究之后,我发现我需要将 Startup.cs 文件指定为 mono 作为要调试的文件。(https://code.visualstudio.com/Docs/editor/debugging)
但是在运行之后mcs -debug Startup.cs
,我得到了这些错误:
Startup.cs(5,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(6,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(7,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(8,17): error CS0234: The type or namespace name `Data' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(9,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(10,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(11,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(12,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(13,16): error CS0234: The type or namespace name `Models' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(14,16): error CS0234: The type or namespace name `Services' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(20,24): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(20,49): error CS0246: The type or namespace name `IApplicationEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(39,16): error CS0246: The type or namespace name `IConfigurationRoot' could not be found. Are you missing an assembly reference?
Startup.cs(42,39): error CS0246: The type or namespace name `IServiceCollection' could not be found. Are you missing an assembly reference?
Startup.cs(62,31): error CS0246: The type or namespace name `IApplicationBuilder' could not be found. Are you missing an assembly reference?
Startup.cs(62,56): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(62,81): error CS0246: The type or namespace name `ILoggerFactory' could not be found. Are you missing an assembly reference?
看起来单声道无法正确调试编译 Startup.cs。尝试设置调试时是否有其他人收到此错误?或者是否有人在单声道、asp.net 5、红隼、vs 代码和 OS X 上使用断点?