今天做excel生成工具的时候遇到

.net core以上版本使用exceldatareader包出现错误System.NotSupportedException: No data is available for encoding 1252
解决方案:

安装nuget的System.Text.Encoding.CodePages包
Install-Package System.Text.Encoding.CodePages -Version 5.0.0

在Program.cs文件或者Status.cs文件中 添加一行
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

搞定!

在stackoverflow中有详细说明

地址 https://stackoverflow.com/questions/50858209/system-notsupportedexception-no-data-is-available-for-encoding-1252