为什么 VS2005 中的 Web 应用程序项目提供“转换为 Web 应用程序”选项?菜单选择

发布于 2024-08-10 20:39:37 字数 547 浏览 7 评论 0原文

我相信我完全理解 Visual Studio 2005 的网站模型与 VS2005 SP1 中完全交付的 Web 应用程序项目模型之间的差异 - 但我遇到了一件令人困惑的事情:

我有一个我编写的 Web 应用程序项目(它有一个 bin包含已编译的projectname.dll 和引用的.dll 的文件夹,等等)。但我刚刚注意到,如果我在解决方案资源管理器中右键单击该项目,则会显示一个名为“转换为 Web 应用程序”的菜单项)。这对我来说毫无意义。

我正在将该项目与 VS2005 中的“网站”解决方案进行比较,并考虑将其转换为 Web 应用程序项目。奇怪的是,解决方案资源管理器没有提供任何与“转换为 Web 应用程序”相关的内容,就像人们认为可能和/或适当的那样。

我的结论是,没有什么可以帮助自动将“网站”构造更改为正确的“Web 应用程序项目”。我认为这一切都必须手工完成。将 App_Code 中的文件重新构建为一个或多个类库项目等任务需要手动完成。

我意识到已经写了很多关于历史和差异的文章,但有人可以解释为什么“转换为网络应用程序”的提议似乎是在“错误”的模型中进行的 - 并且只需确认转换是手动的。

I believe I understand fully the differences between Visual Studio 2005's web site model versus the web application project model that was fully delivered in VS2005 SP1 - but I have run into a confusing thing:

I have a web application project I wrote (it has a bin folder with the compiled projectname.dll and referenced .dlls too, etc.). but I just noticed that if I right-click on the project within Solution Explorer, a menu item called "Convert to Web Application" is exposed). That makes no sense to me.

I was comparing this project to a "web site" solution in VS2005 and contemplating converting it to a web application project. Strangely, the solution explorer offers nothing related to "Conversion to Web App" here like one would think is possible and/or appropriate.

I conclude there is nothing to help automate changing a "web site" construct to a proper "web application project". I assume it all has to be done by hand. Tasks such as reconstituting files in App_Code into one or more class library projects needs to be done manually.

I realize a lot has been written about the history and differences but can someone explain why the offer to "convert to web app" seems to be made in the "wrong" model - and just confirm that conversion is manual.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小猫一只 2024-08-17 20:39:38

转换向导做得不错 - 即,该过程远非严格的手动 - 但您仍然需要花费大量时间从网站转移到 Web 应用程序模型。

aspx 页面的“转换为 Web 应用程序”上下文菜单选项会生成一个 myclass.designer.cs 文件,该文件将标记中定义的控件与代码隐藏类联系起来,从而允许智能感知、编译时验证、和其他事情。

对项目文件执行此操作应该为项目中的所有 aspx 生成设计器文件,并且我相信还会创建一些默认应用程序设置,例如程序集名称等,这些设置未在输出为源的网站项目中定义,不是程序集。

The conversion wizard does a decent job -ie, the process is far from being strictly manual - but you're still going to spend a lot of time moving from the website to web application model.

The "Convert to Web Application" context menu option for aspx pages generates a myclass.designer.cs file, which ties controls defined in markup back to the codebehind class, allowing for intellisense, compile-time validation, and other things.

Performing this action on a project file should generate designer files for all of the aspx's in the project, and I believe also creates some default application settings such as assembly name, etc, that aren't defined in a website project where the output is source, not an assembly.

默嘫て 2024-08-17 20:39:38

我猜测您编写的“Web 应用程序”没有以正确的 vsproj 文件开头。如果您引入的项目没有正确的文件系统方案 .aspx、aspx.cs、aspx.designer.cs,则 Visual Studio 会假设您正在尝试创建“Web 应用程序”并为您提供转换特征。

早在 2005 年,Scott Guthrie 就制作了一个有关将网站项目转换为 Web 应用程序项目的教程。这是关于从网站项目迁移到 Web 应用程序项目的部分

I'm going to guess that the 'web application' that you wrote didn't start out with the correct vsproj file. If you bring in a project that doesn't have the correct file system scheme .aspx, aspx.cs, aspx.designer.cs then visual studio will assume that you're trying to create a 'web application' and gives you that conversion feature.

Back in 2005, Scott Guthrie did a tutuorial about converting a web site project to a web application project. Here is the section about Migrating from a Web Site Project to a Web Application Project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文