I want to install this crate: https://crates.io/crates/cargo-release, so I added it to [dev-dependencies] of Cargo.toml. But when I do cargo build, cargo release command is not available. It became available only when I do cargo install cargo-release.
Could somebody tell how to install this tool without cargo install ? Is it possible to make it auto-installable by adding to [dev-dependencies] ?
dev-dependencies are merely dependencies (on library crates) for tests, examples, and benchmarks. If you want to get a cargo subcommand like cargo-release, you'll have to install it yourself, just like e. g. you needed to install the rust compiler yourself, too.
Right. A dependency (in the sense of "dependencies" in the Cargo.toml) is a library that your code depends on and uses (e. g. importing stuff with use statements).
There are some special cases where dependencies are (to a certain extend) more like executables than like libraries, because they are executed at built-time, which includes proc-macros or built-scripts.
But for cargo subcommands, installing them manually is the typical work flow.
Also note that you typically want to install cargo release globally (for your user) on your system, whereas dependencies are crate-specific. And usually, you wouldn't want to re-build the cargo release subcommand every time you do a clean build or a new crate, so a global / system-wide (at least for your current user) installation is usually appropriate.