# Using export\_service in project.did file

**URL:** <https://forum.dfinity.org/t/using-export-service-in-project-did-file/19164>\
**Category:** Developers\
**Tags:** candid\
**Created:** [March 30, 2023, 12:41pm UTC](https://forum.dfinity.org/t/using-export-service-in-project-did-file/19164 "2023-03-30T12:41:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iljabvh](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@iljabvh](https://forum.dfinity.org/u/iljabvh)\
**Post date:** [March 30, 2023, 12:41pm UTC](https://forum.dfinity.org/t/using-export-service-in-project-did-file/19164/1 "2023-03-30T12:41:28Z")

</div>

Hi there,  
I would like to use the export\_service macro, as defined in my rust library, which I compile to my WASM module.

```auto
use candid::export_service;
export_service!();

#[ic_cdk_macros::query(name = "__get_candid_interface_tmp_hack")]
fn export_candid() -> String {
    __export_service()
}

```

Now what do I set into my project.did file?

I have tried setting

```auto
service :{
"export_candid": () -> (text) query;
}

```

but that seems to not work, as the ~~canister~~ method cannot be ~~deployed~~ called:

`The Replica returned an error: code 3, message: "IC0302: Canister r7inp-6aaaa-aaaaa-aaabq-cai has no query method 'export_candid'"`

Any suggestions? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lwshang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lwshang/32/3394_2.png) [@lwshang](https://forum.dfinity.org/u/lwshang)\
**Post date:** [March 30, 2023, 2:15pm UTC](https://forum.dfinity.org/t/using-export-service-in-project-did-file/19164/2 "2023-03-30T14:15:29Z")

</div>

This thread provides examples of `export_service`:

> [@Automatic generation of Candid from Rust](https://forum.dfinity.org/t/automatic-generation-of-candid-from-rust/14627/2):
>
> Hey yeah we’ve been able to generate candid from rust for a while now. Not sure why it’s still kinda hidden from documentation. All the psychedelic projects use it ! You just need to add the CandidType derive, and the candid\_service(query/update/init) macro to all the methods and types that need to be exported. Then, the export\_service!() macro will generate function that returns the candid from rust, which can be run differently depending on the project setup For projects using a main.rs: You…
