简体   繁体   English

Visual Studio自动命名空间更改

[英]Visual Studio Auto Namespace change

In VS2010SP1, i noticed that moving files around in a project from "Root" to a Folder ABC changes the namespace from MyNameSpace.XY to MyNameSpace.XYABC 在VS2010SP1中,我注意到将项目中的文件从“Root”移动到Folder ABC会将命名空间从MyNameSpace.XY更改为MyNameSpace.XYABC

Is there any option/tweak to prevent that ? 是否有任何选项/调整来防止这种情况?

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. 实体框架从T4模板构建实体模型(即动态创建.cs文件),这就是移动后命名空间发生变化的原因。 If you move simple .cs file, it will not change namespace. 如果移动简单的.cs文件,它将不会更改名称空间。

To resolve this issue right click on the folder (in solution explorer) and set property "Namespace provider" into false. 要解决此问题,请右键单击该文件夹(在解决方案资源管理器中)并将属性“Namespace provider”设置为false。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM