Gradle build fails if VC project file is in use


I used the sample visual-studio project from the native-libraries provided by gradle package.
I am performing the IDE creation task i.e. (creating visual studio projects) using gradle:

Scenario 1 : If we create the “vs” directory (which contains VS project/solution files) parallel to “src” directory.

  • In this case the gradle build works fine even if we have any project file is opened or in use.

Scenario 2 : If we create the “vs” directory (which contains VS project/solution files) inside the hello/cpp or parallel to hello.cpp file.

  • In this case gradle build fails, if we have any project file opened or in use.
    It gives below error:

    C:\tools\Gradle\gradle_test\visual-studio>gradle mainExecutable
    Picked up _JAVA_OPTIONS: -Xmx512M
    :compileMainExecutableMainCpp UP-TO-DATE

FAILURE: Build failed with an exception.

  • What went wrong:
    Failed to capture snapshot of input files for task ‘compileHelloSharedLibraryHelloCpp’ during up-to-date check. See stacktrace for details. C:\tools\Gradle\gradle_test\visual-studio\src\hello\cpp\vs\mainExe.opensdf (The process cannot access the file becaus
e it is being used by another process)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


Total time: 2.845 secs

Actually our requirement is to create the VS project files parallel to the source code, though it is able to creates the project files. The developer will browse the code using VS projects and will use the gradle as build tool. So the issue here is user need to close the project first and run the gradle build which is not convenient way.

Please let me know if you need more information and how to resolve this issue.