visual-studio 命名:解决方案、项目、命名空间和程序集
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1927667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Naming: solution, projects, namespaces and assemblies
提问by bniwredyc
I'm working on naming guidelines for solutions, projects, their default namespaces and assemblies (Visual Studio). Now it looks like that: For example, we have a company named "Company" and a project named "Project". The project has business logic in separate dll, UI (WPF/WinForms) and a web part. There are names of things listed in the question title:
我正在为解决方案、项目、它们的默认命名空间和程序集 (Visual Studio) 制定命名指南。现在看起来像这样:例如,我们有一个名为“Company”的公司和一个名为“Project”的项目。该项目在单独的 dll、UI (WPF/WinForms) 和 Web 部件中具有业务逻辑。问题标题中列出了事物的名称:
Solution name: "Project".
解决方案名称:“项目”。
Business logic dll project name: "Project", default namespace: "Company.Project", assembly name: "Project".
业务逻辑dll项目名称:“Project”,默认命名空间:“Company.Project”,程序集名称:“Project”。
UI project name: "ProjectUI", default namesapce: "Company.Project.UI" (it can be extended in case of multiple versions of UI, like "Company.Project.UI.WPF"), assembly name "Project" (working because it's not a dll).
UI 项目名称:“ProjectUI”,默认名称空间:“Company.Project.UI”(可以在多个版本的 UI 的情况下进行扩展,例如“Company.Project.UI.WPF”),程序集名称“Project”(工作因为它不是 dll)。
Web project name: "ProjectWeb", default namespace: "Company.Project.Web", assembly name: "ProjectWeb" (for web applications).
Web 项目名称:“ProjectWeb”,默认命名空间:“Company.Project.Web”,程序集名称:“ProjectWeb”(用于 Web 应用程序)。
My questions are: do you have guidelines like that? Is it a good idea to describe thoose things? What you think about my approach?
我的问题是:你们有这样的指导方针吗?描述那些事情是个好主意吗?你觉得我的做法怎么样?
I'll be glad if you share ways that you use in your work.
如果您分享您在工作中使用的方法,我会很高兴。
回答by Konamiman
You may want to take a look at Microsoft's Namespace Naming Guidelines, which are by the way very similar to yours.
您可能想看看Microsoft 的 Namespace Naming Guidelines,顺便说一下,它们与您的非常相似。
回答by Matthew Dresser
I think it's definitely a good idea for everyone to work to standards like these. The only thing I might add is that if you do projects for other companies/customers you might want to name projects as follows:
我认为每个人都按照这样的标准工作绝对是个好主意。我唯一要补充的是,如果您为其他公司/客户做项目,您可能希望按如下方式命名项目:
YourCompanyName.CustomerCompanyName.ProjectName.ProjectUI
YourCompanyName.CustomerCompanyName.ProjectName.ProjectUI

