Sort and remove (unused) using statements Roslyn script/code?

后端 未结 5 642
旧时难觅i
旧时难觅i 2020-12-31 09:34

Sort and remove (unused) using statements Roslyn script/code? I\'m looking for some .NET/Roslyn (compiler as service) code that can run through a project and sort and remov

5条回答
  •  太阳男子
    2020-12-31 09:54

    Check out the OrganizeSolution sample project that came with Roslyn. It does something similar to what you want. It does the sorting part. You'll have to also use the SemanticModel like Jeff shows to determine if there are no references to a particular namespace in the source.

提交回复
热议问题