Full framework assemblies are being implicitly pulled in by csc when using msbuild via VS. This creates duplicate references. The problem is due to
https://github.com/dotnet/corefx/blob/ab01852685e659a685af2ace33af5b3cefdf8430/src/Microsoft.XmlSerializer.Generator/pkg/build/Microsoft.XmlSerializer.Generator.targets#L73
Which should include /noconfig and /nostdlib but doesn't.
The tool's usage of Reflection is part of the issue, this problem can be avoided by using a new set of APIs in order to avoid directly using Reflection which loads a bunch of the assemblies that are then duplicate references.
Original issue: dotnet/corefx#41286