I am in the middle of updating a .NET 4.7 Web Application project (based on VB.NET) to add code for processing incoming payments via PayPal. This code is being imported from an older Web Site project.
I am aware of most of the differences between a Web Application and a Web Site project and have successfully converted all my aspx pages to the new format. However, I am hitting an unexpected problem with a set of utility programs contained in a class called MiscCode. This class is saved in a file called MyCode.vb, which is stored in the App_Code folder on my Web Site project.
Public Class MiscCode
Public Shared Function xxxxxxxxx()
'Code
End Function
Public Shared Function zzzzz()
'Code
End Function
End Class
I imported this 'as is' to my Web Application, but when I try to make any reference to the functions in the MiscCode class I get the following error.
- BC30451 'MiscCode' is not declared. It may be inaccessible due to its protection level
I tried adding 'Imports MiscCode' to the top of the relevant page, but this generated two other errors. Firstly, that this Imports statement was unnecessary and the following error.
- BC40056: Namespace or type specified in the Imports 'MiscCode' doesn't contain any public member or cannot be found
Moving MyCode.vb to the root of my Web Application project made no difference and, so far, my searches for assistance with the BC30451 error have not helped. Some guidance would be much appreciated.
Just in case my use of the App_Code folder was inappropriate in a Web Application, I had already transferred MyCode.vb to the root of my project. This didn't fix my problem.
I've just tried moving MyCode.vb to a new folder called MyAppCode, but I still get the BC30451 error.
Hi @AgaveJoe , I've got a similar problem. I'm working with an old WebForms app, which I'm guessing was originally created as a Web Site app, not a Web Application app. (I don't know the guy who wrote it originally. He moved on before I was onboarded to take over this app. Because of the age of the app, I'm guessing Web Applications wasn't a part of Visual Studio when he created the app some 15 years ago.)
Anyway, there is an App_Start folder in the app, with three .vb files in it. It's breaking when the app initially launches, in the Global.asax file. Here's the code:
It breaks on the line RouteConfig.RegisterRoutes(RouteTable.Routes) with the BC30451 error. RouteConfig is a module in App_Start. I'm wondering if I should move all three .vb files from App_Start to the root level of the project?