下载新的
git clone --recursive https://github.com/dotnet/aspnetcore
更新之前clone的,但是没有使用 --recursive参数
使用下面命令
git submodule update --init --recursive
或
git submodule sync --recursive;
git submodule update --init --force --recursive
注意--recursive是必须的 , 以为: ASP.NET Core uses git submodules to include the source from a few other projects.
git checkout v3.1.5
git switch -c myV3.1.5
去掉源链接中包含"darc-int"的链接 (这些是微软内部的源,外部人员无法使用)
如 下面这些需要去掉:
<add key="darc-int-dotnet-extensions-be18161" value="https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-extensions-be18161f/nuget/v3/index.json" />
<add key="darc-int-dotnet-efcore-509fe04" value="https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-efcore-509fe041/nuget/v3/index.json" />
<add key="darc-int-dotnet-core-setup-3acd9b0" value="https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-core-setup-3acd9b0c/nuget/v3/index.json" />
<add key="darc-int-dotnet-corefx-059a4a1" value="https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-corefx-059a4a19/nuget/v3/index.json" />
<add key="darc-int-dotnet-aspnetcore-tooling-d63ec4a" value="https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-aspnetcore-tooling-d63ec4a1/nuget/v3/index.json" />
安装vs ,即使已经安装过vs了 ,也推荐执行下面这个脚本。
因为自己安装的vs可能少安装一些组件啥的 ;
run eng/scripts/InstallVisualStudio.ps1.
其他需要安装的还有
在powershell中执行 .\restore.cmd ,
这期间还会下载一些压缩包啥的 ,比较耗时, 注意能否访问国外网站;
还是在powershell中执行 .\build.cmd
也会下载东西,比较耗时,但是耗时比restore花费的少一些
使用脚本 .\src\Mvc\startvs.cmd ,打开vs ;
这个脚本设置了一下启动时需要的变量,推荐使用这个脚本打开vs;
vs启动后 ,可能会出现加载项目失败的情况 ,这时找到根目录的global.json ,修改里面的SDK版本,改成自己电脑上已经安装的SDK版本;
以我的电脑为例,
C:\Windows\system32>dotnet --info
.NET Core SDK(反映任何 global.json):
Version: 3.1.301
Commit: 7feb845744
那么将原来的global.json中的
"sdk": {
"version": "3.1.103"
},
改成
"sdk": {
"version": "3.1.301"
},
重新加载项目即可 ,另外这里面有个sample ,位置是在: 根目录\src\Mvc\samples\MvcSandbox
原文:https://www.cnblogs.com/francisXu/p/13372930.html