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. XMLHttpRequest: 网络错误 0x2f78,…00002f78

    常在河边走,怎能不湿脚,在web前端开发的过程中总是遇到很多关于IE的故事. 一个get请求,传了一个json对象,包含一串参数,在IE上就出现了这个问题:XMLHttpRequest: 网络错误 0 ...

  2. 11、Logback日志框架介绍和SpringBoot整合实战 2节课

    1.新日志框架LogBack介绍     简介:日志介绍和新日志框架Logback讲解 1.常用处理java的日志组件 slf4j,log4j,logback,common-logging 等     ...

  3. pycharm2018破解

    1.下载 链接:https://pan.baidu.com/s/1G0C9xoUQg6JRgNQYLMIi1w 密码:2z3x 2.修改 "G:\Python\JetBrains\PyCha ...

  4. argv[1] 路径问题

    在看<学习opencv>一书时遇到一个小问题:函数只是通过argv传递参数来读取图片并显示,但是却一直弹出画布,没有图像. 如下:test.c # include<stdio.h&g ...

  5. Ajax+json+jquery实现无限瀑布流布局

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  6. openstack 安全策略权限控制等api接口

    computer API:                创建安全组 /os-security-groups 创建安全组规则 /os-security-group-default-rules Netw ...

  7. jenkins cobertura单元测试

    1.1      Maven 工程 pom.xml 修改 1.2      Build添加插件目标 此时构建项目,会在项目 targer/site/cobertura 目录中生成 html 与 xml ...

  8. mongodb数据库集群及sharding分片配置

    复制集群的配置 1.安装mongodb数据库 在主节点和从节点上都安装mongodb # rpm -ivh mongo-10gen-2.4.6-mongodb_1.x86_64.rpm mongo-1 ...

  9. 转载:获取Nginx源码(1.3.5)《深入理解Nginx》(陶辉)

    原文:https://book.2cto.com/201304/19616.html 可以在Nginx官方网站(http://nginx.org/en/download.html)获取Nginx源码包 ...

  10. springboot:session集中存储到redis

    1.在web工程的基础上,在pom.xml中添加: <dependency> <groupId>org.springframework.boot</groupId> ...