# How to build dars but not include scenarios?

**URL:** <https://forum.canton.network/t/how-to-build-dars-but-not-include-scenarios/121>\
**Category:** App Development\
**Tags:** daml, damlc, daml-sdk\
**Created:** [April 14, 2020, 6:52pm UTC](https://forum.canton.network/t/how-to-build-dars-but-not-include-scenarios/121 "2020-04-14T18:52:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Srivastava](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/vivek_srivastava/32/79_2.png) [@Vivek\_Srivastava](https://forum.canton.network/u/Vivek_Srivastava)\
**Post date:** [April 14, 2020, 6:52pm UTC](https://forum.canton.network/t/how-to-build-dars-but-not-include-scenarios/121/1 "2020-04-14T18:52:42Z")

</div>

**Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful [Daml Script](https://docs.daml.com/daml-script/index.html). We now recommend using that for all purposes. [For more information, and to learn how to use Script please check out @Andreas’ post on our blog](https://daml.com/blog/engineering/daml-script-scenarios-2-0/).**

I have defined templates and scenarios in the same file and some scenarios in specific files, this is great during the dev time. But when I prepare the build for production dars can I avoid including scenarios being compiled and bundled in the dars?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [April 14, 2020, 7:13pm UTC](https://forum.canton.network/t/how-to-build-dars-but-not-include-scenarios/121/2 "2020-04-14T19:13:57Z")

</div>

If you have the scenarios in the same file then you are stuck at the moment. There is no option in the compiler to omit all scenarios when producing a DAR.

However, if you have them in different files but within the same project you get fairly similar properties to having them in the same file, e.g., changing a template in one file will immediately be picked up by the scenario in another file. And in that case you can make something like this work! The crucial part here is the `source` field here. To provide an example, let’s say we have the following file structure:

```haskell
- daml/A.daml
- daml/B.daml
- daml/ATest.daml
- daml/BTest.daml 

```

We assume that the scenarios are in `ATest` and `BTest` and let’s also assume the following dependency tree

```haskell
BTest
  - ATest
    - A
  - B
     - A

```

The crucial part is that there is one module at the root of everything (`BTest`) and one module at the root of the modules without scenarios (`B`). If you do not have such root modules, create two new modules that just import all other modules.

Now we’re ready to make things work: Create two `daml.yaml` files. E.g one in the root directory called `daml.yaml`. Give that one a `source: "daml/B.daml"` field. Now in another directory, e.g., in a `test` subdirectory create another `daml.yaml`file and give that a `source: "../daml/BTest.daml"` field. Now if you run `daml build` in the root directory you will rceate a DAR that only contains `A` and `B` whereas running `daml build` in the `test` directory will include all files including scenarios.
