[英]Is it possible to setup Visual Studio 2017 such that it runs and debugs a .NET Core C# application on remote Linux machine instead of local machine?
My scenario is that I have Visual Studio 2017 running on Windows and all the sources are stored locally on the same Windows machine and I want that code to be shipped to a remote Linux machine, compiled there, run there and remote debugged there. 我的情况是,我在Windows上运行了Visual Studio 2017,并且所有源代码都本地存储在同一Windows机器上,并且我希望将该代码运送到远程Linux机器上,在此处编译,在此处运行并在那里进行远程调试。
With proper configuration I can create a CMake C++ project and have it run and remote debugged on remote Linux machine right out of the box. 通过正确的配置,我可以立即创建一个CMake C ++项目,并在远程Linux机器上运行它并进行远程调试。 Can I have the same for a .NET Core project with C# code? 对于使用C#代码的.NET Core项目,我可以使用相同的名称吗?
I found this question which implies that I could run dotnet publish
and maybe also use "attach to process" then but that doesn't look a straightforward as just selecting a startup item and clicking "Play" in a CMake project. 我发现了这个问题 ,这意味着我可以运行dotnet publish
然后也可以使用“附加进行处理”,但这看起来并不简单,就像在CMake项目中选择启动项并单击“播放”一样。
Can I have the same experience of remote starting and debugging my C# code on remote Linux machine as it works in case of CMake C++ projects in Visual Studio 2017? 我可以像在Visual Studio 2017中的CMake C ++项目中一样具有在远程Linux机器上远程启动和调试C#代码的经验吗?
Can I have the same experience of remote starting and debugging my C# code on remote Linux machine as it works in case of CMake C++ projects in Visual Studio 2017? 我可以像在Visual Studio 2017中的CMake C ++项目中一样具有在远程Linux机器上远程启动和调试C#代码的经验吗?
I'm afraid the answer is negative. 恐怕答案是否定的。 For now, the remote-debugging experience in Linux for .net core
is quite different from that for C++
. 目前, Linux在.net core
的远程调试体验与C++
完全不同。 It would be a bit more complex when configuring remote debugging in Linux for .net core projects. 在Linux中为.net核心项目配置远程调试时,这会有些复杂。
You can't simply select the startup item and click "play" like what you did in CMake C++ projects. 您不能像在CMake C ++项目中那样简单地选择启动项并单击“播放”。
Instead you do need to configure the Attach to Process
in VS after you start the .net core application in Linux .( dotnet publish
command is not necessary, you can use the Publish option in VS, and then copy the output publish directory to a directory with execute permission on the Linux Test VM ) 相反,在Linux中启动.net核心应用程序后,您确实需要在VS中配置“ Attach to Process
。(不需要dotnet publish
命令,可以在VS中使用Publish选项,然后将输出的publish目录复制到目录中在Linux测试VM上具有执行权限 )
Assuming the .net core
you mentioned above indicates asp.net core
, please check Debugging ASP Core on Linux with Visual Studio 2017 for more details about how to configure the environment to get a start. 假设您上面提到的.net core
表示asp.net core
,请检查使用Visual Studio 2017在Linux上调试ASP核心,以获取有关如何配置环境以开始的更多详细信息。 Hope it helps :) 希望能帮助到你 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.