全新的开发环境,我目前使用的系统为Win7 x64, 数据库用的是SQL 2008。小试了一下.NetCore,把过程写下来,以后备查。
刚安装好了VSCodeSetup-x64-1.23.0.exe,又安装了dotnet-sdk-2.1.105-win-x64.exe,至少从现在来讲,这二个都是最新的。
从http://www.aspnetboilerplate.com/上下载了相应的模板。我选择的是Core 2.x与传统方式(JQuery)的网站。

下载并解压,用VSCode打开项目所在的文件夹,点击相应的sln文件,如果是首次,会跳出安装文件扩展的提示,点击“安装“。

安装完成后,点重新加载。

然后会有一些NuGet的一些依赖项需要还原,根据提示点击”restore“即可还原 .NET 项目中指定的依赖项。
出现了一个问题。
分析:DotNet 安装完成后并未重启。命令语句不在PATH环境下。
解决:重新启动VSCode,可解决。
编辑项目的NuGet.Config文件。
<packageSources>
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
文件保存后,在终端执行 dotnet restore 后,dotnet ef 功能就可以用了。
在 MyABPTemplate.EntityFrameworkCore 项目上执行 dotnet ef database update ,数据库就同步完成了。

运行Web项目 dotnet run -p MyABPTemplate.Web.Mvc 运行MVC版本的project。


执行 dotnet run -p MyABPTemplate.Web.Host 运行API


网友评论