Struct tauri_build::WindowsAttributes
source · pub struct WindowsAttributes { /* private fields */ }
Expand description
Attributes used on Windows.
Implementations§
source§impl WindowsAttributes
impl WindowsAttributes
sourcepub fn window_icon_path<P: AsRef<Path>>(self, window_icon_path: P) -> Self
pub fn window_icon_path<P: AsRef<Path>>(self, window_icon_path: P) -> Self
Sets the icon to use on the window. Currently only used on Windows.
It must be in ico
format. Defaults to icons/icon.ico
.
sourcepub fn sdk_dir<P: AsRef<Path>>(self, sdk_dir: P) -> Self
pub fn sdk_dir<P: AsRef<Path>>(self, sdk_dir: P) -> Self
Sets the sdk dir for windows. Currently only used on Windows. This must be a valid UTF-8
path. Defaults to whatever the winres
crate determines is best.
sourcepub fn app_manifest<S: AsRef<str>>(self, manifest: S) -> Self
pub fn app_manifest<S: AsRef<str>>(self, manifest: S) -> Self
Sets the [application manifest] to be included with the application on Windows.
Defaults to:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
§Warning
if you are using tauri’s dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
§Example
The following manifest will brand the exe as requesting administrator privileges. Thus, everytime it is executed, a Windows UAC dialog will appear.
let mut windows = tauri_build::WindowsAttributes::new();
windows = windows.app_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>
"#);
let attrs = tauri_build::Attributes::new().windows_attributes(windows);
tauri_build::try_build(attrs).expect("failed to run build script");
Note that you can move the manifest contents to a separate file and use include_str!("manifest.xml")
instead of the inline string.