Open chucker opened 4 years ago
this is a known an documented drawback. you can use platform specific xaml in a netstandard (or other) shared project because it will be resolved at runtime, but you can't compile it as it doesn't have a dependency on the platform project. Multi-targetting should probably help there, but I haven't tested it yet
this is a known an documented drawback. you can use platform specific xaml in a netstandard (or other) shared project because it will be resolved at runtime, but you can't compile it as it doesn't have a dependency on the platform project.
I could've sworn I didn't see it before, but the warning is in fact right there on the page I read. Sorry! :)
Still, wouldn't it be possible to extend this to a compiler warning if any imported namespace contains targetPlatform
and XamlCompilation
is enabled?
While it is a documented limitation, it should still trigger a compilation error when XAML compilation is enabled. That is the actual bug here. Thanks for reporting @chucker !
Steps to Reproduce
targetPlatform
:Expected Behavior
The page should show a label that reads "macOS MyView".
Actual Behavior
The page is empty. The view seems to fail to resolve, and get silently removed.
However, with
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
removed, I cannot reproduce this.Environment
Build Logs
https://gist.github.com/chucker/d4b18c62a2b93f219acb7ea5f189ab49
Further remarks