Maybe comment out this if block, too?  It's a dependency, but you're adding a reference element, which doesn't have the Id attribute.  Neither dependency nor reference has MinVersion/MaxVersion: https://docs.nuget.org/docs/reference/versioning.