the auto generated did file name is service.did.
which i want to set as backend.did
but i didnt find where to config this .
Of course i cant write a script to rename it .
but i dont know if there is some hidden bug may cause.
here is my dfx.json
do anyone know about it ?
This file is not autogenerated for Rust canisters. It is copied from the one you specify in dfx.json. I recommend you don’t mess with that file
what should i do with dfx.json . any keyword ?
I don’t think you need to do anything. Is there something you’d like to accomplish?
Yes~ we wish to generate name as backend.did inside the .dfx/ic/canisters/backend/ folder.
My frontend friend needs to use it as backend.did file name.
So dfx.json is set to
But what was actually generated was service.did inside .dfx/ic/canisters/backend/ folder.
So we want to somehow change it. instead of manually rename in case of any bug.
I think there may be a misunderstanding about what the field
canisters.<canister name>.candid does. IIUC you think it means that candid is generated at that location. But for Rust canisters there is no automatic candid generation. The field is where dfx expects you to place the candid file. For internal file transformations dfx then copies that file to
.dfx/local/backend/service.did, but this is not something you should or can mess with.
If you want to autogenerate candid files from Rust, please have a look over here: Automatic Candid Generation in Rust: Exploring the ic_cdk v0.10.0 Update
OK. thanks alot ,dear Severin,
I will not manually do anything to
.dfx folder content then .
About generating did file :
I use this two things to generate did file:
cargo build --target wasm32-unknown-unknown --release --package "backend" --features "ic-cdk/wasi"
wasmtime "./target/wasm32-unknown-unknown/release/backend.wasm" > ./backend/backend.did --allow-precompiled
//in end of lib.rs
It can works for me .