Visual Studio 中“网站"和“项目"之间的区别 [英] Difference between 'Web Site' and 'Project' in Visual Studio

查看:36
本文介绍了Visual Studio 中“网站"和“项目"之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
ASP.NET:网站还是网络应用程序?

我注意到,当您启动 Visual Studio 2008 并选择新建项目"->ASP.NET Web 应用程序"而不是新网站' -> 'ASP.NET 网站'.例如,如果您选择项目",那么您可以编译为 .dll,并且每个页面都会获得一个 *.aspx.designer.cs 代码隐藏文件.

I have noticed that there is clearly a difference in what you get when you fire up Visual Studio 2008 and choose 'New Project' -> 'ASP.NET Web Application' instead of 'New Web Site' -> 'ASP.NET Web Site'. For example if you choose 'Project', then you can compile to .dll and each page gets a *.aspx.designer.cs codebehind file.

1) 为什么我们有这两种不同的项目类型?

1) Why do we have these two different project types?

2) 你更喜欢哪个?

3) 为什么我会选择一个而不是另一个?

3) Why would I choose one over the other?

4) *.aspx.designer.cs 文件是怎么回事?

4) What's the deal with the *.aspx.designer.cs files?

推荐答案

1) ASP.NET 2.0 引入了网站"模型,Web 应用程序"模型是原始 .net 框架的项目类型.它们都有不同的用途(见下文).

1) The 'web site' model was introduced with ASP.NET 2.0, the 'web application' model was the project type of the original .net framework. They both have different uses (see below).

2) 这取决于上下文.一个很好的例子是,如果您销售软件产品,您可能希望使用网络应用程序"项目,因为它自然适用于干净编译的代码.

2) It depends on the context. A good example is if you are selling a software product, you may wish to use a 'web application' project because it naturally lends itself to cleanly compiled code.

3) 见上,个人喜好,保养特点.网站"允许您做的一件有趣的事情可能会给您带来很多麻烦,那就是在网站运行时对记事本中的代码隐藏(通常是 *.cs 或 *.vb)文件进行任意更改.

3) See above, personal preference, maintenance characteristics. An interesting thing that a 'web site' allows you to do that can get you in a lot of trouble is making arbitrary changes to code-behind (typically a *.cs or *.vb) file in notepad while the website is running.

4) Designer.cs 文件用于存储自动生成的代码.此代码是由工具生成的."

4) The designer.cs file is used to store the auto-generated code. "This code was generated by a tool."

这篇关于Visual Studio 中“网站"和“项目"之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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