Earlier debugging ASP.Net Core MVC source code in Visual studio 2015 was very easy using global.json file. Has anyone tried to debug ASP.Net Core MVC source code in Visual Studio 2017 RC? Is it possible at all in VS 2017 RC? Can someone who has been successful in debugging MVC source code in VS 2017 RC list down steps please?
Update: I tried setting up symbol source as mentioned in comment by Tseng. However its still not able to load symbols. Its not even searching symbol source https://nuget.smbsrc.net/. Following is symbol server setting.
Following is fiddler screenshot.
It is possible to debug the asp.net core 2.0
source code in Visual Studio 2017. We have to follow the next steps:
If we have already downloaded Visual Studio 2017, we check that our version is at least 15.3
(help -> about Microsoft visual studio). If it is not, then we update by clicking the yellow flag in the right upper corner. We might also have to download the SDK version 2.0
separately.
After updating visual studio 2017, we open command prompt and we execute the command dotnet --version
to identify the current SDK version. If it is prior than 2.0.0 version, then we have to also download the latest SDK version release. We can also check any older installed versions of SDK in C:\Program Files\dotnet\sdk
.
The required packages for master branch in asp.net core open source code in github must be downloaded from myget.org
repository. The default nuget.org
repository is not the appropriate one. Thus we go to tools -> nugget package manager -> package manager settings -> nugget package manager -> package sources
and we click the plus (+) button to add the two new repositories. The required package repository for SDK is https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json
, while the package repository for master branch is https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json
. We click update
for each of the new repository and then we OK
.
We go to github.com/aspnet
and supposing that we want to debug the MVC source code, we click on MVC
link and then we click on releases
link. We download the release 2.0.0
with tag rel/2.0.0
.
We unzip the file and we go to src
folder. In all the project folders inside src
folder, we have to change the inner text of the <TargetFramework>
xml node in each of the *.csproj
files, from netstandard2.0
to netcoreapp2.0
. The change should be the following one:
<TargetFramework>netcoreapp2.0</TargetFramework>
We create a new asp.net core 2.0
project in Visual Studio 2017. We have to pay attention to select asp.net core 2.0
in the next Window because the default selection is asp.net core 1.1
.
asp.net core 2.0 selection
In our new created asp.net core 2.0
project, we have to add a project reference in {project_name}.csproj
file. We right click the project in solution explorer and select edit {project_name}.csproj
. We add the following xml text inside it:
<ItemGroup>
<ProjectReference Include="{mvc_solution_directory_path}\src\Microsoft.AspNetCore.Mvc\Microsoft.AspNetCore.Mvc.csproj" />
</ItemGroup>
{mvc_solution_directory_path}
is the directory path where we unzipped the source code from github and where the mvc.sln
file is located.
Now we have to add each one of the projects located in src
folder of the MVC
open source code. We right click our solution in solution explorer and select add -> existing project
.
We are ready to build our solution.
Trying to debug asp.net core 1.1
by downloading the respective open source version from github, is quite problematic. I have uploaded to github a small utility which automates the steps 4 – 7. I hope that this guide helps. I tested it both in Windows 7 and Windows 10 and i was able to debug the open source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With