C# 如果我在 Visual Studio 中选择“转换为 Web 应用程序”选项有什么作用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/85513/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 11:25:38  来源:igfitidea点击:

What does the option "convert to web application" do if I select it in visual studio?

提问by minty

What does the option “convert to web application” do if I select it in visual studio? If I do convert my site to a web application what are the advantages? Can I go back?

如果我在 Visual Studio 中选择“转换为 Web 应用程序”选项有什么作用?如果我确实将我的网站转换为 Web 应用程序有哪些优势?我可以回去吗?

采纳答案by Sean Gough

Well, it converts your web site to a web application project. As for the advantages, here is some further reading:

好吧,它会将您的网站转换为 Web 应用程序项目。至于优点,这里有一些进一步的阅读:

MSDN comparison -- Comparing Web Site Projects and Web Application Projects

MSDN 比较——比较网站项目和 Web 应用程序项目

Webcast on ASP.NET -- Web Application Projects vs. Web Site Projects in Visual Studio 2008

ASP.NET 网络广播——Web应用程序项目与 Visual Studio 2008 中的网站项目

"In this webcast, by request, we examine the differences between web application projects and web site projects in Microsoft Visual Studio 2008. We focus specifically on the reasons you would choose one over the other and explain how to make informed decisions when creating a Web solution"

“在本次网络广播中,我们应要求检查了 Microsoft Visual Studio 2008 中 Web 应用程序项目和网站项目之间的差异。我们特别关注您选择其中一个项目的原因,并解释了在创建 Web 应用程序时如何做出明智的决定解决方案

The primary difference (to me) between a web application project and a web site is how things gets compiled. In web sites each page has its code-behind compiled into a separate library, whereas in web applications all code-behind gets compiled into a single library.

Web 应用程序项目和网站之间的主要区别(对我而言)是编译方式。在 Web 站点中,每个页面都将其代码隐藏编译到一个单独的库中,而在 Web 应用程序中,所有代码隐藏都编译到一个单独的库中。

There are advantages and disadvantages to both, it really depends. It's also often a matter of opinion.

两者都有优点和缺点,这真的取决于。这也是经常的事的意见

回答by DrFloyd5

Also Answered Hereso go vote that answer up, not this one. Don't give me credit

也在这里回答所以去投票那个答案,而不是这个。不要给我信用

There are two types of web applications in ASP.NET: The Web Site and Web Application Project. The difference between the two are discussed here:

Difference between web site and web applications in Visual Studio 2005

Convert to Website allows you to convert a Web Application Project to a Web Site.

Visual Studio 2003 used the Web Application Project style, but initially VS2005 only supported web sites. VS2005 SP1 brought back Web Applications.

If you don't want to convert your project to a web site, apply SP1 if you're using VS2005. VS2008 can support either.

ASP.NET 中有两种类型的 Web 应用程序:网站和 Web 应用程序项目。这里讨论两者之间的区别:

Visual Studio 2005 中网站和 Web 应用程序之间的区别

转换为网站允许您将 Web 应用程序项目转换为网站。

Visual Studio 2003 使用 Web 应用程序项目样式,但最初 VS2005 仅支持网站。VS2005 SP1 带回了 Web 应用程序。

如果您不想将项目转换为网站,如果您使用的是 VS2005,请应用 SP1。VS2008 都可以支持。

回答by user1749782

Visual studio 2010 will show this option Even if your project is started as a Project(Not website). This may be an Error from VS 2010.

即使您的项目作为项目(非网站)启动,Visual Studio 2010 也会显示此选项。这可能是 VS 2010 的错误。