简体   繁体   中英

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.

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. Can I have the same for a .NET Core project with C# code?

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.

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?

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?

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++ . It would be a bit more complex when configuring remote debugging in Linux for .net core projects.

You can't simply select the startup item and click "play" like what you did in CMake C++ projects.

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 )

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. Hope it helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM