# Native binaries: visualcpp toolchain creates unwanted directories

**URL:** <https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191>\
**Category:** Help/Discuss\
**Created:** [December 11, 2015, 12:07am UTC](https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191 "2015-12-11T00:07:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [December 11, 2015, 12:07am UTC](https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191/1 "2015-12-11T00:07:03Z")

</div>

When I run simple builds for a NativeLibrarySpec with the visualcpp toolchain (msvc 2013), the build process leaves behind a Debug folder in the project root that contains any generated pdb and obj files from one of the passes.

Other than deleting this folder post-build, is there any way to disable/relocate this output?

---

<div class="post-metadata">

**Author:** ![Daniel\_L](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daniel_l/32/6420_2.png) [@Daniel\_L](https://discuss.gradle.org/u/Daniel_L)\
**Post date:** [December 11, 2015, 2:37am UTC](https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191/2 "2015-12-11T02:37:39Z")

</div>

What version of Gradle are you using? I have been using Gradle 1.12 extensively, and I don’t think I saw this problem. I know it’s a older version but still. Are you running the build through a Visual Studio generated solution? I know we did some minor tweak that we haven’t open sourced yet to fix some behaviour of running Gradle through Visual Studio.

---

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [December 11, 2015, 3:53am UTC](https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191/3 "2015-12-11T03:53:39Z")

</div>

I’ve run it on both gradle 2.9 and 2.10 rc1. Not using vs solution or project files - 100% all gradle. Visual Studio 2013 update 4 is installed on the system.

---

<div class="post-metadata">

**Author:** ![Daniel\_L](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daniel_l/32/6420_2.png) [@Daniel\_L](https://discuss.gradle.org/u/Daniel_L)\
**Post date:** [February 12, 2016, 1:56pm UTC](https://discuss.gradle.org/t/native-binaries-visualcpp-toolchain-creates-unwanted-directories/13191/4 "2016-02-12T13:56:55Z")

</div>

The Debug folder comes from Visual Studio. When VS starts a build, it creates an intermediate folder and an output folder for logs and other useless information since we are using Gradle. What I did was to modify the VS project post generation to redirect some path to a single folder (called visualStudio) and add this folder to .gitignore and cleanup task. The added code look like this:

```gradle
    visualStudio {
      projects.all {
        projectFile.withXml {
          asNode().PropertyGroup.findAll({ it.@Label == 'NMakeConfiguration' }).each { configNode ->
            configNode.appendNode('IntDir', "${project.projectDir}${File.separator}visualStudio")
            configNode.appendNode('OutDir', "${project.projectDir}${File.separator}visualStudio")
          }
          asNode().PropertyGroup.findAll({ it.@Label == 'Configuration' }).each { configNode ->
            configNode.appendNode('BaseIntermediateOutputPath', "${project.projectDir}${File.separator}visualStudio")
          }
        }
      }
    }

```

I hope this helps.
