更新时间:2023-02-17 09:51:46
转换为Web应用程序是一个项目/文件级别的命令。你不能把它用在一个 ASPX
文件。
此外,别无他法自动化的方式(即我知道:-)),以code隐藏文件添加到一个ASPX文件。你必须做手工,自己加入相关文件,然后将其添加到.csproj的。
I'm working with Visual Studio 2008 SP1 and ASP.NET MVC v1. When right clicking on a view I do not get the option "Convert to Web Application" that I would need to generate code behind .cs classes. I see that option for the actual project and folders, but not for views (aspx files). I've checked the ProjectTypeGuids to have the "right" (?) values:
{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Any other suggestions as to what I could look for?
Thanks.
(I am aware of design implications of using code behind classes with MVC)
P.S. To do it manually all you have to do is:
"Convert to web application" is a project/file-level command. You can't use it on a single ASPX
file.
Also, there is no alternative automated way (that I know of :-)) to add code-behind files to an ASPX file. You have to do it manually, by adding the relevant files yourself and then adding them to the .csproj.