PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform

三世轮回 提交于 2021-01-24 13:50:06

问题


What might be the error? I looked at similar problems, downgrading the version to 2.0 is workaround but this is not true

DAL.dll

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.4" />
  </ItemGroup>

UIWEBAPP.dll

<ItemGroup>
    <PackageReference Include="CKEditor" Version="3.6.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.4" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>

回答1:


Hey mate try these steps because this way works !!!

1.

dotnet tool install --global dotnet-ef --version 3.0.0

2.

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />

3.

dotnet ef dbcontext scaffold "Server=serveraddresst;Database=db_name;User=db_username;Password=db_password" Microsoft.EntityFrameworkCore.SqlServer -c DataBaseContext -o Models


来源:https://stackoverflow.com/questions/62262004/platformnotsupportedexception-microsoft-data-sqlclient-is-not-supported-on-this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!