Cargo can not resolve crate in build.rs

In my Cargo.toml , I have added the following line

[dependencies]
winrt="0.7.2"

build.rs

use winrt::build;
...

can not compile , got the error E0432 unresolved import winrt, but if I put the above line in my main.rs (and delete the build.rs), it can compile. How does this happen? Many thanks!

You'll need to put it in your [build-depedencies] instead (or also).