------------VsCode开发.net6---------------------------------- 干货如下:
C# Base language support for C# 包含vscode的调试 C# Dev Kit C# Extensions IntelliCode IntelliCode API Usage Examples IntelliCode Completions IntelliCode for C# Dev Kit IntelliCode Insiders NuGet Package Manager GUI vscode-solution-explorer Auto-Using for C# vscode调试时 其他端口需要关闭不占用,点击vscode左侧的虫子按钮即可-运行和调试
调式运行前会自动打开Swagger,截图省略
Vscode CodeFirst 迁移,使用PgSql,code中下面4个nuget包
<ItemGroup> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13" /> </ItemGroup>
迁移使用到的命令
===========CodeFirst 如下两种方式命令 0:使用命令行工具 dotnet ef migrations add Init --注意这里是多一个migrationss dotnet ef database update 1:使用程序包管理器控制台 Add-Migration Init Update-Database 无法将“dotnet-ef”项识别为 cmdlet、函数、脚本文件或可运行程序的名称,解决方案如下: Net6的dotnet-ef工具环境: dotnet tool install --global dotnet-ef --version 7.0.13 .NetCore3的dotnet-ef工具环境: dotnet tool install --global dotnet-ef --version 3.1.0 =========vscode迁移钥使用到的小插件工具 dotnet ef cli全局安装 dotnet tool install --global dotnet-ef 更新EFCore CLI dotnet tool update --global dotnet-ef 卸载EFCore CLI dotnet tool uninstall --global dotnet-ef 验证EFCORE CLI dotnet ef