Search code examples
c#debuggingmsbuildautomated-testsgetgauge

Running Parallel Executions with Gauge Framework


I have a Gauge Test Project in c# (not in core) hosted in a server. Then there is an external tool that sends the gauge run command for different tags. It sends 17 run commands almost at the same time with different tags. I have limited the concurrency of calls for 10 so only 10 get through (kinda off topic). However, for this 10 requests it seems that gauge still needs to use the gauge-bin folder as rarely I get the following error:

D:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3101: Could not write state file "obj\Any CPU\Debug\TestAutomation.csprojResolveAssemblyReference.cache". The process cannot access the file 'D:\home\site\wwwroot\Gauge\Apps\TestAutomation\obj\Any CPU\Debug\TestAutomation.csprojResolveAssemblyReference.cache' because it is being used by another process. [D:\home\site\wwwroot\Gauge\Apps\TestAutomation\TestAutomation.csproj]

D:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4411,5): error MSB3491: Could not write lines to file "obj\Any CPU\Debug\TestAutomation.csproj.FileListAbsolute.txt". The process cannot access the file 'D:\home\site\wwwroot\Gauge\Apps\TestAutomation\obj\Any CPU\Debug\TestAutomation.csproj.FileListAbsolute.txt' because it is being used by another process. [D:\home\site\wwwroot\Gauge\Apps\TestAutomation\TestAutomation.csproj]

I know those files are located in obj\Any CPU\Debug. I don't know how to find a work around to avoid this error. My first thought is to delete the files inside the obj folder as the test seems to run fine after that. However, the files are still generated when I execute a test.


Solution

  • This error indicates that there are multiple msbuild processes trying to build the same project concurrently. This causes the resource conflict in the obj folder.

    If you need to run the same Gauge project at the same time, Could you try something like this:

    • build the project first (outside gauge).
    • set GAUGE_CUSTOM_BUILD_PATH to the location of the output folder from above..
    • run gauge run specs

    This will use the prebuilt binaries to execute the tests. You may also see an improvement in the run time.