Closed massaynus closed 1 year ago
This should be moved to https://github.com/dotnet/SqlClient
cc @ajcvickers
UPDATE!
when I build the same code using the --os
and --arch
flags it works normally.
dotnet run --arch x64 --os linux
Hello, the flags works, thank you very much :bow: , but and for debug, how is it?
as mentioned in the docs you can add a -c|--configuration <CONFIGURATION>
flag to specify that
for example: dotnet run --arch x64 --os linux --configuration Debug
Although by default the project is ran in Debug mode
I'm sorry, I don't make myself understand. I was referring to debuging step by step in vscode at Linux. I get the same error and I'm trying to add the args in the launch.json file, but didn't work
I already have the answer. In the Task.json file add the args
And in the launch.json file add linux-x64 to the program path
Also consider updating sql server 2017 to 2019 (it comes with some improvements) and I would wait until 2022 become downloadable without a login to get that one too.
I was having a similar issue using PopOs, my app was running normally on Windows, but on Linux I got this message when I ran . After much searching, I found a solution that solved my problem on a Google forum (https://groups.google.com/g/exceldna/c/4PQLjPj76N4/m/w-0kVCYVDAAJ).
I added the following instructions in my csproj:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cp $(OutDir)runtimes/unix/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll $(OutDir)" />
</Target>
And it worked! I am using .net 6, entity framework 6.0.9
Thank you for this solution, @luizgambali. This points towards a definitive solution, which is something that I would expect from Microsoft collaborators.
Regarding this error, everything I have seen is everybody closing issues without any solution or any clue, except from the community. And this kind of thing disappoints a lot.
The entire ecosystem that we are talking here is "proprietary" somehow: SQL Server is a Microsoft product and not a community project. And if we can't get help from the product collaborators/maintainers, I really don't have any motivation to keep using SQL Server without some kind of external requirement.
Here are the issues related to this very same problem (sorry for being repetitive, but this has been ignored for months):
https://github.com/dotnet/SqlClient/issues/1423 https://github.com/dotnet/SqlClient/issues/1427 https://github.com/dotnet/SqlClient/issues/1811 [...and so many others, even on "efcore" and "runtime" repositories, just search for "PlatformNotSupported"...]
I really don't see the WHY most of this issues are being closed, because they are not solved in any way. There is even issues where people changed the database from SQL Server to Sqlite and it is marked as "solved". So should I really change the database system because in SQL Server this error is supposed to occur? [Irony, of course.]
I agree, and since sql server is technically free, I actually wonder why Microsoft did not open source it yet.
I like the speed how issues get closed at SqlClient
side.
@massaynus Don't we want to have at least described workaround? Don't we want to have a fix of this issue in the future?
@jinek I would love for everybody to have a clear solution
as of currently there seems to be a build issue, since all I needed is to hint the architecture I'm targeting to get things fixed!
UPDATE! when I build the same code using the
--os
and--arch
flags it works normally.
dotnet run --arch x64 --os linux
Also this solution from @luizgambali hints at the same issue, it seems to be a build problem at the end of the day, maybe the linux archs are not picked up properly or not all of them are supported.
Currently we have seen the problem on both a debian based distro (PopOS) and an Arch based distro (Manjaro), but Ubuntu, CentOS, Debian would work just fine.
I was having a similar issue using PopOs, my app was running normally on Windows, but on Linux I got this message when I ran . After much searching, I found a solution that solved my problem on a Google forum (https://groups.google.com/g/exceldna/c/4PQLjPj76N4/m/w-0kVCYVDAAJ).
I added the following instructions in my csproj:
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Command="cp $(OutDir)runtimes/unix/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll $(OutDir)" /> </Target>
And it worked! I am using .net 6, entity framework 6.0.9
At the end of the day not all distoros are officially supported 🤔 Docs
Maybe the real issue is how to properly support linux? 😂
@massaynus Thank you for re-opening. I'm not sure whether I did something on my system or no, but now, after installing dotnet 7 and removing 6, it started to work.
@jinek I haven't tried .NET 7 yet on my arch system, and it's not on hand currently so I cannot confirm if the issue is resolved 😓
Maybe the real issue is how to properly support linux? joy
Yep, I believe that is natural intention not to depend on OS title/id. However, I did not investigate so much as you guys, i had to drop this issue. Still, may be makes sense to keep issue open at least by the moment we confirm it's fixed with dotnet 7.
That fix dotnet run --arch x64 --os linux
is just not clear for everybody how to run, some folks even have no clue of possible outcomes.
And this one <Exec Command="cp $(OutDir)runtimes/unix/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll $(OutDir)" />
looks like would break incremental build. Sometimes that's not viable or not desired.
Closing this issue as it's a .NET Runtime platform detection issue.
Is there an existing issue for this?
Describe the bug
I have a backend API made with asp.net core that relies on EF Core 6 and MSSQL for the data layer. the API and the migration commands run fine on both Windows and Ubuntu/Debian. When the same code and commands are used on Manjaro/Arch they fail with the following output:
Expected Behavior
It should run fine across all platforms as it used to do in .NET 5!
Steps To Reproduce
The code repo
Exceptions (if any)
System.PlatformNotSupportedException
.NET Version
6.0.102
Anything else?