使用global.json文件可以很容易地在Visual Studio 2015中调试ASP.Net Core MVC源代码。有没有人尝试在Visual Studio 2017 RC中调试ASP.Net Core MVC源代码?VS 2017 RC完全有可能吗?可以在VS 2017 RC中成功调试MVC源代码的人列出以下步骤吗?
更新:我尝试设置符号源,如曾在评论中提到的。但是,它仍然无法加载符号。它甚至没有搜索符号源https://nuget.smbsrc.net/。以下是符号服务器设置。
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
.
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.
现在,我们必须添加位于开源代码src
文件夹中的每个项目MVC
。我们在解决方案资源管理器中右键单击我们的解决方案,然后选择add -> existing project
。
我们准备建立我们的解决方案。
尝试asp.net core 1.1
通过从github下载相应的开源版本进行调试是很成问题的。我已经将一个小型实用程序上传到github,该实用程序可以自动执行第4步至第7步。我希望本指南对您有所帮助。我在Windows 7和Windows 10中都对其进行了测试,并且能够调试开源代码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句