I maintain an old ASP.NET WebForms app written years ago by someone else. He wrote it using VB.NET. I'm not a VB.NET expert. I've been working on the app to make it build in our on-prem TFS. I've resolved some issues, but other issues have come up as I work on it. I came across this post in this forum, which helped: Error BC30451 'xxxxxxx' is not declared. It may be inaccessible due to its protection level
However, I'm still getting the error. In the reference link it was suggested that since the app the poster was discussing was a Web Site app, that there might be issues. The app I'm maintaining has an App_Start folder in it, which I guess suggests this might have been a Web Site app, instead of a Web Application app. I've moved the 3 .vb files out of App_Start, putting them all in the root level of the web application. However, I'm still getting the BC30451 error:
This is where my inexperience at VB.NET comes into play. The method RegisterRoutes is in a RouteConfig.vb file, which is a module file. As I understand it, Modules in VB.NET are analogous to static classes in C#. Here's RouteConfig.vb:
Imports System.Web.Routing Imports Microsoft.AspNet.FriendlyUrls Public Module RouteConfig Public Sub RegisterRoutes(ByVal routes As RouteCollection) Dim settings = New FriendlyUrlSettings() settings.AutoRedirectMode = RedirectMode.Permanent routes.EnableFriendlyUrls(CType(settings, FriendlyUrlSettings)) End Sub End Module
I had thought that RegisterRoutes might need to be declared using Shared, which I think is like static in C#. I tried that, but VS 2019 indicated to me that was wrong, so I removed it. Should there be some other declaration I should apply to RegisterRoutes to make it visible to Global.asax?