I have written a CLR Assembly that I wish to deploy to SQL Server 2017 (14.0.3048.4). The assembly uses C# and Targets .NET Framework 4.8, which is installed on the server (Release 528049, Version 4.8.03761). I am using Visual Studio 2022 (17.8.3) to write the CLR Functions.
When I run the 'CREATE ASSEMBLY' Command from the .dll, I receive the following warning and error message:
Warning: The Microsoft .NET Framework assembly 'system.diagnostics.tracing, version=4.2.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Msg 6586, Level 16, State 1, Line 77
Assembly 'System.Diagnostics.Tracing' could not be installed because existing policy would keep it from being used.
I think I understand the warning that is being given, but is it something that I actually need to worry about - I would really like to be able to deploy the CLR Project - How can I (should I?) bypass this error?
Background
I think that I am using the latest version of system.diagnostics.tracing, so this answer does not apply (Although I did try different versions). I wondered whether I should be changing binding redirects as per this question, but I was not confident that this would do anything and couldn't find the files I needed to update.
I think the issue may be in the usage of ClosedXML.Excel, since the project worked without the function that uses that, but I'm not sure that I should actually be blaming that assembly. I tried going back to version 0.97 of ClosedXML, seeing comments about stability, but that caused other issues to start cropping up, so I went back to 1.102 (latest stable) and the error mentioned above.
I have tried targeting .NET 4.7.2 in the CLR Project, but that did not help either. I also tried adding a reference to a copy of System.Diagnostics.Tracing, but for some reason it does not populate into the bin/Release folder that I copy onto the server. I have added and removed and re-added all the .dlls I could think of to the GAC.