tunnelvisionlabs / ReferenceAssemblyAnnotator

IL weaver to add nullability annotations to .NET reference assemblies
MIT License
72 stars 8 forks source link

Net35 projects lose reference to System.Data when referencing ReferenceAssemblyAnnotator #29

Closed jnm2 closed 4 years ago

jnm2 commented 4 years ago

@sharwell You had mentioned that the net35 reference assemblies include one mixed-mode implementation assembly, System.Data, and that Mono.Cecil fails to rewrite mixed-mode assemblies. I'm seeing this in a net35 project with an explicit (necessary) reference to System.Data:

MSB3267 The primary reference "System.Data", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "System.Data" or retarget your application to a framework version which contains "System.Data".

Along with compiler errors due to missing types from that assembly.

I wonder if https://github.com/0xd4d/dnlib can write mixed-mode assemblies. If not, I wonder if either Cecil or dnlib can strip out the mixed-mode stuff since this assembly is only being used as a ref assembly. If not, the original non-rewritten System.Data "reference" assembly should stay referenced so that the project can compile.