什么应该是类库和应用程序中的文件夹strcuture? [英] what should be the folder strcuture in both class library and application ?

查看:62
本文介绍了什么应该是类库和应用程序中的文件夹strcuture?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii,



如果我们想要添加额外的资源,应该是类库和应用程序项目中的完整文件夹strcut ..



为js我们创建js文件夹,对于我们创建图像文件夹的图像。



这些

Hii,

what should be the complete folder strcutures inside class library and application project if we want to add extra resources ..

for js we create js folder , for images we create image folder .

what is the exact tier folder strcture for these

推荐答案

与Java相比,它在.NET中无关紧要。我认为这是.NET的好处之一。



但是,由于几个不同的实际原因,将所有源代码都放在目录的子目录中是很好的。项目文件。如果使用Visual Studio,则在解决方案资源管理器中添加文件夹将导致在文件系统中创建相应的子目录。此外,源代码相对于项目文件的位置便于文件搜索和其他事情。由于类似的原因,最好将每个项目放在一个单独的根目录中,换句话说,不要将不同项目的目录混合在一起,无论它们是否在同一解决方案中使用。



即使上面解释的规则也不严格,它们与项目和构建的功能无关。我建议保留它们只是为了方便Visual Studio的工作,以避免步骤和Visual Studio行为之间的混乱。



现在,有名称空间这样的方面和子目录。 Visual Studio可以使用一些预生成的内容创建所有类型的文件。默认情况下,自动生成的类型将放在以默认命名空间命名的命名空间中(在项目属性中设置),后跟。+子目录名+'。'...,层次结构。您可以遵循此命名方案,但这也不是必需的。我个人自由选择命名空间命名,有时不使用子目录和命名空间名称之间的任何关系。



这就是全部。最重要的是,您可以根据您的常识和习惯使用自己的目录结构来组织起来。您可以根据需要创建任意数量的javascript文件夹,CSS文件夹,将CSS,Javascript与程序文件混合使用,等等。在引用这些文件时,使用相对路径名或相对于站点根目录的路径名。



还有一件事:当然,ASP.NET页面文件的位置决定了他们的URL路径。在大多数情况下,我会以这种方式保留这些URL。但是,您始终可以使用 URL重写或URL映射或路由:

http://support.microsoft.com/kb/976111 [ ^ ],

http://msdn.microsoft。 com / en-us / library / ms972974.aspx [ ^ ],

http:// msdn。 microsoft.com/en-us/library/cc668201.aspx [ ^ ]。



-SA
It absolutely does not matter in .NET, in contrast to Java. I think this is one of .NET benefits.

However, by several different practical reasons, it's good to have all source code in the sub-directories of the directory of the project file. If you use Visual Studio, adding a "folder" in a solution explorer will cause creation of corresponding sub-directories in the file system. Also such location of source code relative to the project files is convenient for file search and other thing. By similar reasons, it's good to have each project in a separate root directory, in other words, don't mix together the directories of different projects, no matter if they are used in the same solution or not.

Even the rules explained above are not strict, and they have nothing to do with functionality of projects and the build. I recommend to keep them only for convenience of work with Visual Studio, to avoid the mess between your steps and Visual Studio behavior.

Now, there is such aspect as namespaces and sub-directories. Visual Studio can create all types of files with some pre-generated content. By default, the auto-generated types will be put in the namespaces named after the default namespace (you set in the project properties), followed by '.' + subdirectory_name + '.'…, hierarchy. You can follow this naming schema, but this is also not a requirement. I personally freely chose namespace naming and sometimes not use any relationship between sub-directory and namespace names.

That's all. On top of that, you can use your own directory structure according to you common sense and your habits to get organized. You can create as many javascript folders, CSS folders as you want, mix CSS, Javascript with program files, and so on. Use relative path names, or path names relative to the site root directory when referencing these files.

One more thing: of course, location of ASP.NET page files determine their URL paths. In most cases, I would keep those URL's this way. However, you can always use such thing as URL rewrite or URL mapping or routing:
http://support.microsoft.com/kb/976111[^],
http://msdn.microsoft.com/en-us/library/ms972974.aspx[^],
http://msdn.microsoft.com/en-us/library/cc668201.aspx[^].

—SA


这篇关于什么应该是类库和应用程序中的文件夹strcuture?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆