Open rajesh78 opened 1 year ago
No idea how you're loading your DLLs, but you're most likely using the wrong Microsoft.Data.SqlClient.dll file.
Hi @slozier @BCSharp I am also facing the same issue, below are the steps that I tried.
Step 1: I have created a Class library project in .Net6.0 Step 2: I have installed below packages through nuget package manager Microsoft.EntityFrameworkCore.Tools Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore
Step 3: I have created DatabaseContext through entiryframework. i have used SQL server. Step 4: The C# Library works fine when I tested with a Console Application. Step 5: I am getting an error “SystemError: Microsoft.Data.SqlClient is not supported on this platform” in IronPython when i load the Class Library DLL(Step 1)
When you nuget install the package, the Microsoft.Data.SqlClient.dll
that ends up in the main application folder is just a stub assembly that throws PlatformNotSupportedException
on everything. The DLL you actually want is under the runtimes
folder. If you look at your console application folder there's probably a <assembly name>.deps.json
which .NET uses to find the correct DLL to load. This is probably why the console application works (I assume if you were to remove the deps file it'd start throwing PNSE).
Hi @slozier, Thanks for the response. I tried the below steps but got the same error "SystemError: Microsoft.Data.SqlClient is not supported on this platform"
Step 1: Copied the folders inside the runtimes folder that are generated on publish. Step 2: Pasted them inside the path IronPython.3.4.1\net6.0\runtimes (this is after unzip of IronPython.3.4.1)
@kumarKovuru I think you misunderstood. I was trying to explain the the .deps.json file pointing to the assemblies in the runtimes folder is required by .NET to find the correct assembly. Another option that might work would be putting the DLLs from the runtimes folder in the root - which might be fine if you don't care about the cross-platform aspect of things...
Discussed in https://github.com/IronLanguages/ironpython3/discussions/1744
Thanks to @BCSharp. I am able to create the dot net project by following the tips from the above link by @BCSharp.
The new problem i am facing is - I am not able to call the api if it involves a MSSQL database interaction. I am getting the below error. "SystemError: Microsoft.Data.SqlClient is not supported on this platform."
Any information if Iron Python support the MSSQL interaction?