Article From:https://www.cnblogs.com/shumin/p/9967854.html

Preface

  coreIt took a long time to discover that many little partners did not know how to debug core code.

  As you can imagine, when using MVC in the past, you did not need to publish code, but directly pointed to the source code of the project by IIS address, and then attached to the process w3wp.exe to debug.

  You can’t do that in core projects anymore.

text

  1. Install Open Command Line

            

 

  

  2. To configure

           Let’s start with a core website, right-click on the solution, and the Open Command Lint option appears at the bottom.

            

          Advanced Default opens the DOS panel, and the path is the current project path

         Input: dotnet run startup project

         

 

        Open https://localhost:5001 in the browser to browse the project.

        Then attach to the process in VS, select the dotnet.exe process (select to view all user processes)

        So the breakpoint comes in.

        If you change the code, you need to terminate with Ctrl + C and then redistribute dotnet run.

        

       

        This is equivalent to the previous way of positioning IIS directly under the website project path, which is convenient enough.

        Later, it was found that it was more convenient, even dotnet run did not need to be knocked.

        Select Settings and change the column Command arguments to: / K dotnet run

        Set up, the next click on “Open Com and Line” – & gt; “Default” to directly execute dotnet run.

        PS:The boss pointed out that the command could be changed to dotnet watch run, so that code changes do not need to re-execute the command.

       

       

 

Link of this Article: Debugging. NET CORE Code

Leave a Reply

Your email address will not be published. Required fields are marked *