【发布时间】:2015-11-22 20:38:42
【问题描述】:
我是 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。
该项目在 Kestrel 上本地运行 localhost:5000 就好了。我还可以通过 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?
看起来 mono 无法正确调试编译 Startup.cs。尝试设置调试时是否有其他人收到此错误?或者有没有人在使用 mono、asp.net 5、kestrel、vs code 和 OS X 时有断点?
【问题讨论】:
-
注意:使用版本“1.0.0-rc1-final”
标签: macos mono asp.net-core visual-studio-code kestrel-http-server