Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

sql server - How can I change the encoding of files generated by the 'dotnet ef' CLI tool in Powershell Core?

I use the following command to generate the C# (.NET Core 3.1) files from a SQL Server DB (SQL Server 2016):

dotnet ef dbcontext scaffold $ConnectionString Microsoft.EntityFrameworkCore.SqlServer --no-build  --no-onconfiguring -f -c "MyContext" -o Table1/DataAccess -t dbo.Table1

When I run this in Powershell 5.1, the files are encoded in UTF-8.

But when I use Powershell Core 7.1.0, the files are encoded in Western European (Windows).

I don't think the dotnet ef tool uses the default encoding of Powershell, because the output of $OutputEncoding is US-ASCII for powershell 5.1 and UTF-8 for Powershell Core 7.1.0.

I would like to use the dotnet ef CLI in Powershell Core 7.1.0 to generate UTF-8 encoded files. How can I do this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...