Do not require runtime reference to Generator.Equals.Runtime.dll
tom-englert opened this issue · comments
Even for a simple usage like this
[Equatable]
internal partial class Class1
{
public string Text { get; set; } = string.Empty;
}
a runtime reference to Generator.Equals.Runtime.dll
is required, just because of the usage of the attribute.
Proposed solution:
Decorate the attributes with e.g. [Conditional("GENERATOR_EQUALS")]
(like e.g. JetBrains does for their annotation attributes: https://www.jetbrains.com/help/resharper/Code_Analysis__Annotations_in_Source_Code.html)
This way a runtime reference should only be needed when using one of the special comparators.
It will take me a couple of weeks to look at this as I'm travelling at the moment.
Adding the conditional attribute is not enough here, the attribute declarations would need to be injected into the Roslyn context, so that they no longer exist in the runtime project.
It's just about removing the reference to the Generator.Equals.Runtime.dll
- it's not a problem if the attributes are in the runtime dll.
The PR did exactly this - just inspect the target assembly with e.g. ILSpy.
My bad, I think I understand the purpose of the change now.
Released in 2.2.3.