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. 转载-通俗理解BN(Batch Normalization)

    转自:参数优化方法 1. 深度学习流程简介 1)一次性设置(One time setup)          -激活函数(Activation functions) - 数据预处理(Data Prep ...

  2. RNN(1) ------ “理解LSTM”(转载)

    原文链接:http://www.jianshu.com/p/9dc9f41f0b29 Recurrent Neural Networks 人类并不是每时每刻都从一片空白的大脑开始他们的思考.在你阅读这 ...

  3. V4L2学习记录【转】

    转自:http://blog.chinaunix.net/uid-30254565-id-5637600.html V4L2学习记录 这个还没有分析完,先在这放着,防止电脑坏掉丢了,以后再完善 V4L ...

  4. 【转】深入浅出JMS(二)--ActiveMQ简单介绍以及安装

    现实的企业中,对于消息通信的应用一直都非常的火热,而且在J2EE的企业应用中扮演着特殊的角色,所以对于它研究是非常有必要的. 这篇博文介绍一款开源的JMS具体实现——ActiveMQ.ActiveMQ ...

  5. windows Tomcat apr安装

    背景 这都是当时不了解这个东西,又怕忘了记下来的,其实试验后.也就那么回事. 转载 Tomcat Native 这个项目可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO ...

  6. PHP框架CodeIgniter--URL去除index.php

    今天学习CodeIgniter简称CI的第一天,记录下学习心得. CI中国https://codeigniter.org.cn/user_guide/general/urls.html?highlig ...

  7. 集成Struts2+Spring+Hibernate_两种方案

    集成Struts2+Spring+Hibernate 第一种方案:让Spring创建Struts2的Action,不让Spring完全管理Struts2的Action      Struts2 Act ...

  8. IOS支持多国语言

  9. selenium webdriver+python基本操作

    # -*- coding:utf-8 -*-#导入模块from selenium import webdriver from selenium.common.exceptions import NoS ...

  10. uva12436 回头再做一次

    线段树维护等差数列,结点维护首项+公差即可 #include <cstdio> #include <cstring> #include <algorithm> us ...