Add Linux support to .NET language extension
This PR adds Linux support to the .NET language extension, which currently only supports Windows.
This involves the following:
- Creating scripts for building and shipping the Linux native library. PowerShell was chosen as a scripting language to serve as a potential base for a cross-platform script.
- The Windows-specific APIs used in the native library have been augmented with Linux library calls, guarded by standard preprocessor defines.
- Due to differences in the .NET runtime lookup logic in
hostfxrbetween Linux and Windows, using a hardcodedhostfxrlibrary path was a no go for portability (e.g. .NET packages on RHEL and Debian do not install .NET in the same base directories). Instead, we make use ofnethost(in the form of thelibnethost.astatic library provided by the .NET runtime) to first do the hostfxr lookup. This approach has the advantage of honoringDOTNET_ROOTandinstall_locationfiles if they exist, which hostfxr does not.
Additionally, this bumps references to net6.0 up to net8.0, since the former is EOL.
At this point, this has been tested manually on SQL Server running on Ubuntu 22.04 LTS. A .NET 8.0 assembly was successfully executed.
@microsoft-github-policy-service agree company="Raincode srl"
@MarkpageBxl , have you ever met this error:
Error: Could not find a part of the path '/home/mssql_satellite/externallibrariessandboxprivatepath'
I have rebased on main, and made an additional fallout fix re the use of the DOTNET_ROOT environment variable in DotnetEnvironment.cpp, as the existing code was Windows only.
I also assume we should probably upgrade to net10.0 at this point, though that could be a separate work item as well.