TensorFlow.NET icon indicating copy to clipboard operation
TensorFlow.NET copied to clipboard

[BUG Report]: Latest TensorFlow.NET is not strong named signed

Open ericstj opened this issue 5 months ago • 1 comments

Description

I can no longer reference this assembly in from my own strong name signed assembly.

I get

CSC : error CS8002: Referenced assembly 'Tensorflow.Binding, Version=0.150.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.

This regressed with https://github.com/SciSharp/TensorFlow.NET/commit/b2fe5ca080dba6bd6473e386696d7c84191dc7ba#diff-1355f2c1cc0c2076facc4422480563fc7943b2329cc45397f90c4a833bda68c8L50 which removed the AssemblyOriginatorKeyFile property.

This is a warning as error, if the warning is ignored, the following exception will occur when consuming the assembly from a strongly-named assembly on .NETFramework.

System.IO.FileLoadException: Could not load file or assembly 'Tensorflow.Binding, Version=0.150.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Reproduction Steps

Compile the following useTfNetSN.zip

This demonstrates both the warning and the runtime exception on .NETFramework.

Known Workarounds

None. We need to add back the strong name. This is a binary breaking change that also blocks upgrade.

Configuration and Other Information

No response

ericstj avatar Jul 09 '25 17:07 ericstj

I tried to rollback to version 0.110.1 (before the removal of the strong name) and it also doesn't work, failing at runtime with:

Could not load file or assembly 'OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

This is due to the introduction of a dependency on OneOf -- https://github.com/SciSharp/TensorFlow.NET/commit/acae9b3e39b4b5b12bc2fdeff21c4d566c486d10

If I rollback to 0.100.4 it works again, since this is prior to the introduction of the OneOf dependency. IMO this binding library should be kept simple with few dependencies.

ericstj avatar Jul 09 '25 19:07 ericstj