【nuget】PackageReference

时间:2022-09-08 15:38:02

.net 爬虫

    <PackageReference Include="HtmlAgilityPack" Version="1.9.0" />
<PackageReference Include="HttpCode.Core" Version="4.2.0" />
    https://github.com/2881099/TcpClientHttpRequest

MongoDb

    <PackageReference Include="MongoDB.Driver" Version="2.7.3" />

Json 序列化

    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />

gbk 支持

    <PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);注册

swagger

    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
            services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
});
app.UseSwagger(); app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});

mysql

    <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.14" />

postgre

    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.1" />

redis

    <PackageReference Include="CSRedisCore" Version="3.0.39" />

发送邮件

Install-Package MailKit
https://github.com/jstedfast/MailKit

读Json

<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
var builder = new ConfigurationBuilder();
builder.AddJsonFile("AppSetting.json");
var configuration = builder.Build();
return configuration.GetConnectionString("");