In various code files of various projects, Visual Studio sometimes gives an error message when I tell it to remove and sort the usings of the code file. The message:
"Your project or one of its references does not currently build. If you continue with this operation, required usings may be removed."
However, this is not true. Required usings are not removed when telling VS to continue, and the project does build.
I have Googled this issue, looked in MSDN, and tried to figure out why I get this on certain code files but not others, but no no avail.
Has anyone else encountered this, and if so, any ideas what this is about?
Ps. I am running VS 2012 Ultimate, but I saw this from at least 2005.
This error message can come up erroneously, and is a known issue documented out on Microsoft Connect:
http://connect.microsoft.com/VisualStudio/feedback/details/785457/remove-unused-usings-falsely-reports-that-project-does-not-build-for-certain-files
It will not be fixed with the current MSBuild compiler, but will be fixed with Roslyn.
Workaround:
You can disable the warning message by going to Tools->Options->Text Editor->C#->Advanced->"Warn if build errors exist when organizing usings".
Keep in mind this has the downside that it won't protect you any more if your solution really does not build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With