asp.net core for vs code
1,命令
dotnet new --help 查询命令帮助
D:\github\test2>dotnet run 启动web程序
dotnet build 编译代码
dotnet restore 还原包
dotnet publish 发布项目
2,模板
"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>
- 用VSCode开发一个asp.net core 2.0+angular 5项目(4): Angular5全局错误处理
- dot watch+vs code提升asp.net core开发效率
- 使用VS Code开发asp.net core (下)
- 用VSCode开发一个基于asp.net core 2.0/sql server linux(docker)/ng5/bs4的项目(3)
- 使用VS Code开发调试ASP.NET Core 1.0
- 用VSCode开发一个基于asp.net core 2.0/sql server linux(docker)/ng5/bs4的项目(1)
- VS Code开发调试ASP.NET Core 1.0
- VS Code for .Net core 1.0 environment configuration
- 使用VSCode创建Asp.Net Core
- dotnet watch+vs code提升asp.net core开发效率
- ASP.NET Core - VSCode安装和配置
- 使用VS Code开发asp.net core (上)
- 用VSCode开发一个asp.net core2.0+angular5项目(5): Angular5+asp.net core 2.0 web api文件上传
- .NET Core VS Code 环境配置
- Atlas Control Toolkit and Source Code for the Build-in Asp.Net 2.0 Providers
- .Net Core Linux centos7行—vscode开发,linux部署运行
- docker4dotnet #3 在macOS上使用Visual Studio Code和Docker开发asp.net core和mysql应用
- Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download !
- First ASP.NET Core Application on a Mac Using Visual Studio Code
- Asp.net 5+VS Code 配置使用