Visual Studio 2022 - implementing Razor Pages not recognizing namespace after upgrading to .NET 7
I'm wondering if anyone has experience with I'm stuck on something that should probably be simple... I'm currently working on a Razor Pages application in Visual Studio 2022, and after upgrading to .NET 7, I'm working with an scenario where my pages are not recognizing certain namespaces that were previously valid. For example, I have a page model in `Pages/MyPage.cshtml.cs` that references a model from `Models/MyModel.cs`, but I'm getting the following behavior: `The type or namespace name 'Models' does not exist in the namespace 'YourNamespace'`. I've verified that the namespace is correct and matches the folder structure. I have tried cleaning and rebuilding the solution, as well as ensuring that all references are up to date. Here's a snippet of my `MyPage.cshtml.cs`: ```csharp using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using YourNamespace.Models; // This is causing the scenario namespace YourNamespace.Pages { public class MyPageModel : PageModel { public MyModel MyModelInstance { get; set; } public void OnGet() { MyModelInstance = new MyModel(); } } } ``` The project is set to use the latest SDK in the `.csproj`: ```xml <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> </PropertyGroup> </Project> ``` I also checked for any `global using` directives that might need to be added, but nothing seemed to resolve the scenario. Has anyone else encountered this after upgrading and found a solution? Am I missing something obvious? For context: I'm using C# on Linux. I'd really appreciate any guidance on this. This is happening in both development and production on Ubuntu 20.04. I'm open to any suggestions. What's the best practice here?