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).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.