microsoft/windows-app-rs

Where do the winmd files come from? (besides the generated one)

Closed this issue · 4 comments

Hi! I have some questions regarding how the fns are generated, specifically for the XAML part of it.

I've been playing with the metadata generator project and now I'm able to generate the Microsoft.WindowsAppSdk.Generated.winmd file.
However, I wonder where do the rest of the winmd files in the .windows/winmd folder come from 🤔. Are those also generated?

I got into generating my own bindings due to the reduced API surface of the windows-rs crate (microsoft/windows-rs#1715) so I just set the min_xaml option to false. That helped and now I can call some more methods like SetContent but I can't seem to find others like Windows::new.

So, in fewer words:

  • Are the APIs published in this package under UI::Xaml substantially different from those in windows-rs (even with min_xaml disabled)?
  • How/Where can I get the mentioned winmd files?
  • Can we have some docs in how to use WinUI 3 from Rust with just windows-rs?
    • I know now we have this amazing crate (windows-app-rs) that simplifies the process, but I think documenting how it works will help people who are trying to experiment with it, use newer preview versions of the WindowsAppSDK or just tweaking it.

Hi @jesdazrez! I'm still in the process of documenting the overall concept (from header to Rust crate, start to finish) but to answer your specific questions:

  • Are the APIs published in this package under UI::Xaml substantially different from those in windows-rs (even with min_xaml disabled)?
  • How/Where can I get the mentioned winmd files?

All the other metadata in .windows/winmd is specific to the Windows App SDK and ships in its NuGet package.

  • Can we have some docs in how to use WinUI 3 from Rust with just windows-rs?

It is not possible to use WinUI 3 from Rust with just windows-rs. You'll need to generate all the bindings, then worry about bootstrapping, manifestation, etc. which basically just recreates this crate. (Anything in the XAML namespace is basically unsupported by both crates. You won't get very far without XAML code generation or XAML compilation, I'm afraid.)

Thanks for the answer @riverar!
I have setup the bootstrapping part of the app and it's working as expected.
I see some of the files (e.g. Microsoft.Foundation) are present in both lib/uap10.0.17763 and lib/uap10.0.18362. I'm guessing I should use the ones depending on the least Windows version I want to target? So for example the one under uap10.0.17763 if I want to target Windows 10 1809 and up?

Yup that's right. Some features only support version Y and up.

Ok, thanks for all the help!