I have a masterpage in the '/" folder that inherits from a class in the App_Code folder, which in turn inherits from System.Web.UI.MasterPage.
This used to work in early versions of Visual Studio, but I wrote it a long time ago. I created a new project with the latest Visual Studio, added all the aspx, master, and vb files from the old project to it, and it won't compile.
It seems to be unable to find the code-behind class for the master page when that file is in the app_code folder.
Is this a bug of the newer Visual Studio? Is there a workaround?
Is this a bug of the newer Visual Studio? Is there a workaround?
Most likely a bug in your code introduced when moving the files or creating the new project. Keep in mind, App_Code is used in Web Site projects (dynamically compiled code) not Web Applications. What kind of project did you create?
It seems that I created a web-application. I now looked for alternatives in the new Visual Studio but there aren't any. If you want to make an asp.net website, it has to be a web-application, unless I'm missing something.
It seems that I created a web-application. I now looked for alternatives in the new Visual Studio but there aren't any. If you want to make an asp.net website, it has to be a web-application, unless I'm missing something.
Are you asking how to create a Web Site project in Visual Studio?
Or you can simply open your existing Web site project in Visual Studio. You can also open a Web Application in Visual Studio. It's not clear why you created a new project.
Member
61 Points
111 Posts
classes in app code folder can't be inherited from?
Mar 13, 2020 06:21 PM|RateFor|LINK
I have a masterpage in the '/" folder that inherits from a class in the App_Code folder, which in turn inherits from System.Web.UI.MasterPage.
This used to work in early versions of Visual Studio, but I wrote it a long time ago. I created a new project with the latest Visual Studio, added all the aspx, master, and vb files from the old project to it, and it won't compile.
It seems to be unable to find the code-behind class for the master page when that file is in the app_code folder.
Is this a bug of the newer Visual Studio? Is there a workaround?
All-Star
53081 Points
23649 Posts
Re: classes in app code folder can't be inherited from?
Mar 14, 2020 12:08 PM|mgebhard|LINK
Most likely a bug in your code introduced when moving the files or creating the new project. Keep in mind, App_Code is used in Web Site projects (dynamically compiled code) not Web Applications. What kind of project did you create?
Edit: https://docs.microsoft.com/en-us/previous-versions/ex526337(v=vs.140)?redirectedfrom=MSDN
Member
61 Points
111 Posts
Re: classes in app code folder can't be inherited from?
Mar 15, 2020 12:31 PM|RateFor|LINK
To mgebhard:
It seems that I created a web-application. I now looked for alternatives in the new Visual Studio but there aren't any. If you want to make an asp.net website, it has to be a web-application, unless I'm missing something.
All-Star
53081 Points
23649 Posts
Re: classes in app code folder can't be inherited from?
Mar 15, 2020 12:45 PM|mgebhard|LINK
Are you asking how to create a Web Site project in Visual Studio?
https://superuser.com/questions/1441880/visual-studio-2019-web-site-template/1476332
Or you can simply open your existing Web site project in Visual Studio. You can also open a Web Application in Visual Studio. It's not clear why you created a new project.