Open wjsimon opened 1 month ago
@PureWeen @MackinnonBuck This is actually a MAUI issue, the targets file in the WebView SDK has the offending line:
This line blindly includes all *.razor
files as RazorComponent
items, and since it's in a targets file it is included after the users .csproj file, so ignores any tweaks they do there.
See also https://github.com/dotnet/razor/issues/10954 and https://github.com/dotnet/maui/issues/25019
Work around via Directory.Build.targets from dotnet/razor#10954 works great, thank you very much :)
Moving this to Maui.
@Redth can u move this to Maui?
We've found some similar issues:
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
Note: You can give me feedback by 👍 or 👎 this comment.
This issue has been verified using Visual Studio 17.12.0 Preview 5 (9.0.0-rc.2.24503.2 & 8.0.92 & 8.0.3) & 17.11.5(7.0.101). Can repro this issue on android and windows platforms.
Description
If a .razor file is attempted to be removed from the build via the .csproj file it is still built.
This does not happen in other Blazor-based project templates, e.g. a Blazor WebAssembly Standalone App. Setting the "Build Action" property to "None" here will result in the .razor file not being included in the build. I did not test all available blazor-based templates for this.
The .csproj snippet in question:
Steps to Reproduce
The app will succesfully build, and start showing the content of the excluded "Home.razor" file. I've tried this with .NET 8.0 as well as the .NET 9 Preview (9.0.0rc.2.24503.2)
Link to public reproduction project repository
No response
Version with bug
8.0.82 SR8.2
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
No response
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
Android 14 - API 34, Windows SDK 10.0.10941.0
Did you find any workaround?
No response
Relevant log output
No response