Apparently the problem is due to an incompatibility between the use of certain libraries (winapi and windows-sys) which use different versions of COM. At least so I deduce from the documentation I've read.
There's a workaaround:
On Cargo.toml, use.
[build-dependencies]
embed-manifest = "1.3.1"
And on the root of the project (not the src dir) create a build.rs file with the following content:
use embed_manifest::{embed_manifest, new_manifest};
fn main() {
if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
embed_manifest(new_manifest("Contoso.Sample")).expect("unable to embed manifest file");
}
println!("cargo:rerun-if-changed=build.rs");
}
This embeds a manifest together with the executable, solving the issue.