CodeConverter icon indicating copy to clipboard operation
CodeConverter copied to clipboard

VB->C# removing invalid Imports

Open wizzardmr42 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. VB ignores Imports statements which are invalid, but C# treats them as a compiler error. Old projects can have a lot of these cluttering up files from references that have been removed.

Describe the solution you'd like An option for the CodeConverter to remove these or comment them out.

Describe alternatives you've considered Search and replace, but that's an extra step.

Additional context n/a

wizzardmr42 avatar Apr 02 '25 16:04 wizzardmr42

This may be possible, either by scanning for namespace existence (being careful of casing), or by using the compiler diagnostics after conversion (but this runs the risks of issues earlier in the process snowballing). You're usually much better off getting the code 100% compiling, then running existing formatting tools

GrahamTheCoder avatar Apr 04 '25 08:04 GrahamTheCoder