区分生成代码中的 global::System 和 foo.System
Differentiating between global::System and foo.System in generated code
我正在 VS 2015 中开发一个多项目解决方案。其中一个项目是 foo.System
,您可能已经注意到它与 [=14] 之间存在一些潜在的混淆=].当
这样的事情时,这会导致组件设计器生成的代码出现问题
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
给出错误 The type or namespace name 'ServiceProcess' does not exist in the namespace 'Tapestry.System'
因为编译器然后在 foo.System
而不是 System
.
中查找 ServiceProcess
显然我可以编辑生成的代码来澄清(如 this related question 中的答案中所述),但这些更改将在下次生成代码时被覆盖。有什么办法可以解决这个问题,即坚持要求我的老板重命名 foo.System
?
正如 Scott Hannen 和 Hans Passant 在评论中所解释的那样,无论我的问题可能存在任何其他答案,真实 答案是重命名 foo.System。 (有关该过程的信息,请参阅 这个答案
至 "How to rename a Project Folder from within Visual Studio?")
我正在 VS 2015 中开发一个多项目解决方案。其中一个项目是 foo.System
,您可能已经注意到它与 [=14] 之间存在一些潜在的混淆=].当
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
给出错误 The type or namespace name 'ServiceProcess' does not exist in the namespace 'Tapestry.System'
因为编译器然后在 foo.System
而不是 System
.
显然我可以编辑生成的代码来澄清(如 this related question 中的答案中所述),但这些更改将在下次生成代码时被覆盖。有什么办法可以解决这个问题,即坚持要求我的老板重命名 foo.System
?
正如 Scott Hannen 和 Hans Passant 在评论中所解释的那样,无论我的问题可能存在任何其他答案,真实 答案是重命名 foo.System。 (有关该过程的信息,请参阅 这个答案 至 "How to rename a Project Folder from within Visual Studio?")