When migrate from v1 to v2, manually add field [lib]
to cargo.toml failed the cargo check, how to fix it?
#11450
-
When create a template from v2, i found there's an additional field [lib]
# The `_lib` suffix may seem redundant but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
name = "tauri_app_lib"
crate-type = ["staticlib", "cdylib", "rlib"] Then after migrate my project following the guiding migrate from v1, i found the new field not mentioned in guidence. I tried manually add it to my cargo.toml, but then the error: failed to parse manifest at `xxxx\src-tauri\Cargo.toml`
Caused by:
can't find library `myapp_lib`, rename file to `src/lib.rs` or specify lib.path
Failed to load workspaces. Since its necessary saied by the comment, how to properly add it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You also need to split up the old main.rs file into lib.rs and main.rs for this. (Explained at the top of your link just below the [lib] field) |
Beta Was this translation helpful? Give feedback.
You also need to split up the old main.rs file into lib.rs and main.rs for this. (Explained at the top of your link just below the [lib] field)
I'd also recommend to create a new create-tauri-app project for comparison if the docs aren't good enough.