pub struct WindowsAttributes { /* private fields */ }Expand description
Attributes used on Windows.
Implementations§
Source§impl WindowsAttributes
impl WindowsAttributes
Sourcepub fn new_without_app_manifest() -> Self
pub fn new_without_app_manifest() -> Self
Creates the default attribute set without the default app manifest.
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 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, every time 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.
Sourcepub fn append_rc_content<S: Into<String>>(self, content: S) -> Self
pub fn append_rc_content<S: Into<String>>(self, content: S) -> Self
Append additional .rc content to the generated resource file on Windows. This can be called multiple times to append multiple contents.