You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dotnet publish -r win-x64 not publish right version of System.Data.SqlClient for netcoreapp3.0 and get PlatformNotSupportedException #29522
dotnet --info
.NET Core SDK(反映任何 global.json):
Version: 3.0.100-preview5-011568
Commit: b487ff10aa
运行时环境:
OS Name: Windows
OS Version: 10.0.18895
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\
Host (useful for support):
Version: 3.0.0-preview5-27626-15
Commit: 61f30f5a23
changed the title [-]`dotnet publish -r` not publish right version of `System.Data.SqlClient` for netcoreapp3.0 and get `System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.`[/-][+]`dotnet publish -r win-x64` not publish right version of `System.Data.SqlClient` for `netcoreapp3.0` and get `PlatformNotSupportedException`[/+]on May 12, 2019
@yyjdelete We are able to reproduce this issue locally by following your steps. After some investigation, the problem is due to the wrong System.Data.SqlClient.dll in the publish folder.
The nuget package contains a bunch of System.Data.SqlClient.dlls for various platforms. When using dotnet publish on your application, it failed to find the correct dll for netcoreapp3.0 so it copied the general one which was in lib\netcoreapp2.1 as a result. The actual working System.Data.SqlClient.dll is in runtimes\win\lib\netcoreapp2.1 which should be picked up with the executable.
We have tested netcoreapp2.1 and dotnet publish can work fine without PlatformNotSupportedException. However, since we haven't add netcoreapp3.0 yet and the System.Data.SqlClient nuget package uses strong-named assembly, dotnet publish is not able to work properly.
One possible workaround for now is to manually copy the dll file from runtimes\win\lib\netcoreapp2.1 to the publish folder and this can eliminate the exception. Or you may need to wait for the support of netcoreapp3.0 in the future.
Have you tried with .NET Core SDK Version: 3.0.100-preview6-012264.
This issue seems to occur with older SDKs (preview5) but not with the newer one. Maybe it was fixed with some other changes in SDK.
Activity
[-]`dotnet publish -r` not publish right version of `System.Data.SqlClient` for netcoreapp3.0 and get `System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.`[/-][+]`dotnet publish -r win-x64` not publish right version of `System.Data.SqlClient` for `netcoreapp3.0` and get `PlatformNotSupportedException`[/+]karinazhou commentedon May 15, 2019
Hi @yyjdelete , thank you for reporting this. I will see whether I can reproduce this on my side.
karinazhou commentedon May 16, 2019
@yyjdelete We are able to reproduce this issue locally by following your steps. After some investigation, the problem is due to the wrong
System.Data.SqlClient.dllin the publish folder.The nuget package contains a bunch of
System.Data.SqlClient.dlls for various platforms. When usingdotnet publishon your application, it failed to find the correct dll for netcoreapp3.0 so it copied the general one which was inlib\netcoreapp2.1as a result. The actual workingSystem.Data.SqlClient.dllis inruntimes\win\lib\netcoreapp2.1which should be picked up with the executable.We have tested netcoreapp2.1 and
dotnet publishcan work fine withoutPlatformNotSupportedException. However, since we haven't add netcoreapp3.0 yet and theSystem.Data.SqlClientnuget package uses strong-named assembly,dotnet publishis not able to work properly.One possible workaround for now is to manually copy the dll file from
runtimes\win\lib\netcoreapp2.1to the publish folder and this can eliminate the exception. Or you may need to wait for the support of netcoreapp3.0 in the future.lefig commentedon May 19, 2019
Hi @karinazhou,
We happen to have the same problem too. It would be sure good to hear that the publish command does indeed get fixed in the next release.
Best
cheenamalhotra commentedon Jul 15, 2019
Hi @yyjdelete @lefig
Have you tried with .NET Core SDK Version: 3.0.100-preview6-012264.
This issue seems to occur with older SDKs (preview5) but not with the newer one. Maybe it was fixed with some other changes in SDK.
Please confirm so we will close the issue.
yyjdelete commentedon Jul 16, 2019
@cheenamalhotra
Verified this is not happen with preview6 for me.
Feel free to close it.