Visual Studio的自动命名空间的变化空间、Visual、Studio

2023-09-03 17:11:29 作者:小脸红扑扑

在VS2010SP1,我注意到,从根移动文件中的一个项目,一个文件夹ABC 改变从MyNameSpace.XY的命名空间MyNameSpace.XYABC

In VS2010SP1, i noticed that moving files around in a project from "Root" to a Folder ABC changes the namespace from MyNameSpace.X.Y to MyNameSpace.X.Y.ABC

有任何选项/调整,以prevent呢?

Is there any option/tweak to prevent that ?

推荐答案

实体框架构建从T4模板中的实体模型(即在飞行中产生cs文件),这就是为什么移动后的空间变化。 如果将简单的cs文件,它不会改变命名空间。

Entity framework constructs the entity model from an T4 template (ie creates .cs file on the fly) that's why the namespace changed after move. If you move simple .cs file, it will not change namespace.

要解决此问题,右键单击该文件夹(在解决方案资源管理),并设置属性命名空间提供者为假的。

To resolve this issue right click on the folder (in solution explorer) and set property "Namespace provider" into false.

祝你好运!