#[cfg(target_os = "windows")]
use winres;
#[cfg(target_os = "windows")]
fn main() {
use std::io::Write;
// only build the resource for release builds
// as calling rc.exe might be slow
if std::env::var("PROFILE").unwrap() == "release" {
let mut res = winres::WindowsResource::new();
res.set_icon("resources\\ico\\fiscalidade_server.ico")
.set_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
"#,
);
match res.compile() {
Err(error) => {
write!(std::io::stderr(), "{}", error).unwrap();
std::process::exit(1);
}
Ok(_) => {}
}
}
}
#[cfg(not(target_os = "windows"))]
fn main() {}
Rust生成的exe如何设置使用清单文件,设置图标和执行权限
最新推荐文章于 2025-03-06 23:32:43 发布