1

I'm working on a multi-project solution in VS 2015. One of the projects is foo.System, which you may have noticed creates some potential confusion between that and, y'know, System. This is causing issues in the Component Designer generated code when something like

this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();

gives the error The type or namespace name 'ServiceProcess' does not exist in the namespace 'Tapestry.System' because the compiler then looks for ServiceProcess in foo.System instead of System.

Obviously I can edit the generated code to clarify (as explained in the answers in this related question), but those changes will get overwritten next time the code is generated. Is there any way to fix this short of insisting to my boss that we rename foo.System?

octothorpentine
  • 319
  • 2
  • 18
  • 2
    Rename it. It's not worth the eternity of trouble. Many years ago I watched my .NET instructor fumble around for 10 minutes in front of a class because she was trying to use a framework `Color` enum in a class or namespace she had named `Color`. She eventually gave up without ever realizing what the problem was. – Scott Hannen Feb 13 '18 at 01:58
  • Two identifier names are reserved to the framework, Microsoft and System. Fix the real problem. – Hans Passant Feb 13 '18 at 08:00
  • Fair enough. Make that an answer, and I'll accept it. – octothorpentine Feb 13 '18 at 20:55
  • As it's been over a week, I've written and accepted my own answer. Should one of you return and post your own answer, I'll accept that instead. – octothorpentine Feb 21 '18 at 17:12

1 Answers1

0

As explained in comments by Scott Hannen and Hans Passant, regardless of any other answer to my question that may exist, the real answer is to rename foo.System. (For info on that process see this answer to "How to rename a Project Folder from within Visual Studio?")

octothorpentine
  • 319
  • 2
  • 18