the Package: System.Text.Encoding.CodePages (ver:4.4.0) cannot be published
I found this package of version 4.4.0 cannot be publish when I use "dotnet publish". when I change to version 4.3.0, It's ok, It has rutimes\win and runtimes\unix. for version 4.4-preview, it has only runtimes\win, no runtimes\unix.
@ringrid could you tell what version of net core you are targeting in your app? if you can share a simple project we can look at that will be good.
CC @weshaggard
@tarekgh my dotnet core info: Product Information: Version: 2.0.2 Commit SHA-1 hash: a04b4bf512
Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.0.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
@tarekgh I found it was normal in console app, This problem only occurs in web applications. My steps are as follows: 1、dotnet new web 2、dotnet add package System.Text.Encoding.CodePages -v 4.4.0 3、dotnet restore 3、Add simple code in Main method: Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.GetEncoding("GBK"); 4、dotnet publish
I could not found System.Text.Encoding.CodePages.dll under the "publish" folder.
@ringrid we believe this is expected because it is part of the closure of ASP.NET and as such ships in the runtime store with ASP.NET. If you run your sample web application you will see that it actually functions correctly.
@davidfowl do you know how the web applications filter out binaries for publishing?
@tarekgh It could not running correctly, I copied the publish folder to Linux and run it, It throwed exception, the system was unable to find System.Text.Encoding.CodePages.
@ringrid when you publish the bits to use on Linux, you'll need to specify the runtime RID. something like
dotnet publish --runtime linux-x64
for the complete list of the RID, you can look at https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
I tried that and it is publishing all needed assemblies correctly.
@tarekgh Thanks for your reply. I think I did not describe my problem clearly. I have known it can be normally by using RID, but my Linux OS has already installed dotnet core SDK, not dotnet runtime. I think it can "write once, run everywhere", and i do not want copy the packages included by SDK. before this question, other packages can be published normally, but this package can not be published, why?
Thanks for your help again!
Thanks @ringrid for clarification.
@davidfowl looks when referencing the SqlClient package which is referencing System.Text.Encoding.CodePages, the web app publishing will filter out System.Text.Encoding.CodePages because it is in the closure of the SqlClient package. Is that right? do you know why System.Text.Encoding.CodePages is filtered out when publishing the web app?
"System.Data.SqlClient/4.4.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.4.0",
"System.Security.Principal.Windows": "4.4.0",
"System.Text.Encoding.CodePages": "4.4.0",
"runtime.native.System.Data.SqlClient.sni": "4.4.0"
},
@tarekgh Did you have any result?
@davidfowl should be able to help here as I don't know how the web apps publish its bits. Also, I am going to move this issue to asp.net repo as this is not specific to corefx
This issue was moved to aspnet/Mvc#6983
@tarekgh thanks a lot. :+1: