dotnet / dotnet/project-system
Blazor page relocation causes non compilable project
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
1. Initialize a blazor project.
2. Create a blazor page (in /Pages)
Example.razor:
```c-sharp
@page "/Example"
Example
@code {
protected override void OnInitialized()
{
base.OnInitialized();
Console.Out.Write("this should run, and compile");
}
}
```
3. Move the code to a code behind class
Pages/Example.razor.cs
```c-sharp
namespace Project.Pages;
public partial class Example
{
protected override void OnInitialized()
{
base.OnInitialized();
Console.Out.Write("this should run, and compile");
}
}
```
4. Move the Example.razor from /Pages to /Areas/Core/Pages and change the namespace to Project.Areas.Core.Pages
5. Run the project.
6. Find that the project is not compiling due to `no suitable method to overide in Example.razor.cs`
### Expected Behavior
Relocating a blazorpage with code-behind should compile, like a relocated blazorpage with code within is compiling
### Steps To Reproduce
S.a.
### Exceptions (if any)
_No response_
### .NET Version
6.0.104
### Anything else?
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Contributor guide
Assessment
This issue has not been assessed yet.