1,命令

2,模板

3,更换启动浏览器

4,vscode使用nuget

5,使用ef migration

6,配置.net core的工作目录

7,使用dotnet ef migrations命令

8,指定migration生成的目录

9,vscode使用Bower

10,引用项目

1,命令

dotnet new --help 查询命令帮助

D:\github\test2>dotnet run 启动web程序

dotnet build 编译代码

dotnet restore 还原包

dotnet publish 发布项目

2,模板

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using test3.Models; namespace test3.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
} public IActionResult About()
{
ViewData["Message"] = "Your application description page."; return View();
} public IActionResult Contact()
{
ViewData["Message"] = "Your contact page."; return View();
} public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

Controller模板

3,更换启动浏览器

windows下启动浏览器命令: C:\Windows\System32>cmd.exe /C start http://localhost:5000/api/values

"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "C:\\Users\\Hunter\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
"args": "${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},

更新配置

4,vscode使用nuget

①安装nuget

② ctrl + shift +P 选择nuget,然后输入包名称回车下载

③包版本变更

打开.csproj文件,直接更改PackageReference下的Version

然后dotnet restore

5,使用ef migration

dotnet ef migrations add initialCreate  Add-Migration【添加更新实体】

dotnet ef database update  Update-Database【向数据库更新】

dotnet ef migrations remove  Remove-Migration【删除最后一个migration文件,前提是该migration文件为update到数据库】

dotnet ef database update LastGoodMigration Update-Database LastGoodMigration【回滚到指定的migration文件。不会删除migration文件。如果不需要migration文件可以通过dotnet ef migrations remove删除掉】

dotnet ef migrations script  Script-Migration【打印出数据库变更脚本】

6,配置.net core的工作目录

program:需要执行的dll
cwd:被调试程序的工作目录

7,使用dotnet ef migrations命令

需要在工程文件中加入

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.2"/> 和 <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.2"/>

8,指定migration生成的目录

dotnet ef migrations add init -o Data/Migrations

以后再添加不用使用  -o Data/Migrations 直接会添加在Data/Migrations文件夹下

9,vscode使用Bower

①vscode安装Bower扩展

Ctrl + Shift +  p 就可以使用Bower了

②在项目中添加.bowerrc文件指定包安装路径

{
"directory": "wwwroot/lib"
}

③添加bower.json文件

{
"name": "MvcDemo2",
"private": true,
"dependencies": {
"jquery": "3.1.1",
"bootstrap": "3.3.7",
"zTree":"3.5.33"
}
}

10,引用项目

<ItemGroup>
<ProjectReference Include="..\IdentityServer4\IdentityServer4.csproj" />
</ItemGroup>

asp.net core for vs code的更多相关文章

  1. asp.net core 使用EF7 Code First 创建数据库,同时使用命令创建数据库

    1.首先下载vs2015的Asp.Net Core(RC2)的插件工具(https://www.microsoft.com/net/core#windows)2.创建一个asp.net Core的项目 ...

  2. ASP.NET Core EFCore 之Code First

    1.在.NET Core项目中使用Nuget引用包 Sql Server 请安装 Microsoft.EntityFrameworkCore.SqlServer 2.添加实体类 [Table(&quo ...

  3. ASP.NET Core模块概述

    原文地址:ASP.NET Core Module overview By Tom Dykstra, Rick Strahl, and Chris Ross ASP.NET Core模块(ANCM)让你 ...

  4. ASP.NET Core Module overview模块概述

    原文地址:ASP.NET Core Module overview By Tom Dykstra, Rick Strahl, and Chris Ross ASP.NET Core模块(ANCM)让你 ...

  5. 如何在ASP.NET Core Web API中使用Mini Profiler

    原文如何在ASP.NET Core Web API中使用Mini Profiler 由Anuraj发表于2019年11月25日星期一阅读时间:1分钟 ASPNETCoreMiniProfiler 这篇 ...

  6. asp.net core使用identity+jwt保护你的webapi(三)——refresh token

    前言 上一篇已经介绍了identity的注册,登录,获取jwt token,本篇来完成refresh token. 开始 开始之前先说明一下为什么需要refresh token. 虽然jwt toke ...

  7. docker4dotnet #3 在macOS上使用Visual Studio Code和Docker开发asp.net core和mysql应用

    .net猿遇到了小鲸鱼,觉得越来越兴奋.本来.net猿只是在透过家里那田子窗看外面的世界,但是看着海峡对岸的苹果园越来越茂盛,实在不想再去做一只宅猿了.于是,.net猿决定搭上小鲸鱼的渡轮到苹果园去看 ...

  8. ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序

    原文:Your First ASP.NET Core Application on a Mac Using Visual Studio Code 作者:Daniel Roth.Steve Smith ...

  9. Windows下构建ASP.NET Core+Code First+Docker

    背景介绍 本文将会示范如何在Windows系统下基于ASP.NET Core构建跨平台服务,并通过Docker容器运行发布. 首先说一下为什么选择这一套组合: 我本人和我们Code4Thought团队 ...

随机推荐

  1. 数据库操作之整合Mybaties和事务讲解 5节课

    1.SpringBoot2.x持久化数据方式介绍          简介:介绍近几年常用的访问数据库的方式和优缺点 1.原始java访问数据库             开发流程麻烦           ...

  2. Fragment与Activity之间的相互通信

    https://blog.csdn.net/u012702547/article/details/49786417 https://blog.csdn.net/carson_ho/article/de ...

  3. SILC超像素分割算法详解(附Python代码)

    SILC算法详解 一.原理介绍 SLIC算法是simple linear iterative cluster的简称,该算法用来生成超像素(superpixel) 算法步骤: 已知一副图像大小M*N,可 ...

  4. Spring+SpringMVC+Mybatis整合(二)

    目录结构:

  5. 【转】Python数据类型之“集合(Sets)与映射(Mapping)”

    [转]Python数据类型之“集合(Sets)与映射(Mapping)” 一.集合类型(Sets) 集合对象是不同的(不可重复)hashable对象的无序集合.常见用法包括:成员关系测试.移除序列中的 ...

  6. git安装及基础用法

    1.安装GitGit-2.9.3-64-bit.exe 2.打开Git Bash,设置用户名,Email $ git config --global user.name "Your Name ...

  7. 转载:第2章 Nginx的配置 概述《深入理解Nginx》(陶辉)

    原文:https://book.2cto.com/201304/19623.html Nginx拥有大量官方发布的模块和第三方模块,这些已有的模块可以帮助我们实现Web服务器上很多的功能.使用这些模块 ...

  8. 03-MySql安装和基本管理

    本节掌握内容: MySQL的介绍安装.启动 windows上制作服务 MySQL破解密码 MySQL中统一字符编码 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 O ...

  9. 解决win 10下git bash中文乱码

    解决步骤如下: 1.在git bash窗体下右键,选择options 2.在打开的配置窗口左侧选择  Text,然后在右侧选择locale为zh_CN,Character set 为GBK,点击OK保 ...

  10. Pandas详解一

    pandas简介 pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的.Pandas 纳入了大量库和一些标准的数据模型,提供了高效地操作大型数据集所需的工具.pandas提 ...