The embed-manifest
crate provides a straightforward way to embed
a Windows manifest in an executable, whatever the build environment,
without dependencies on external tools from LLVM or MinGW.
If you need to embed more resources than just a manifest, you may find the winres or embed-resource crates more suitable. They have additional dependencies and setup requirements that may make them a little more difficult to use, though.
To embed a default manifest, include this code in a build.rs
build
script:
```rust use embedmanifest::{embedmanifest, new_manifest};
fn main() { if std::env::varos("CARGOCFGWINDOWS").issome() { embedmanifest(newmanifest("Contoso.Sample")) .expect("unable to embed manifest file"); } println!("cargo:rerun-if-changed=build.rs"); } ```
See the crate documentation for information about how to customise the embedded manifest.
For the avoidance of doubt, while this crate itself is licensed to you under the MIT License, this does not affect the copyright status and licensing of your own code when this is used from a Cargo build script.