MSBUILD : error MSB1022: Response file does not exist.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
MSBuild task fails with the following error in the build logs:
MSBUILD : error MSB1022: Response file does not exist.
Cause
Bamboo stores the build parameters used in a MSBuild task in a .rsp
response file in the tmp
directory. The error happens when the Windows user running the agent or server does not have write permission on the tmp
directory. The default tmp directory is C:\Windows\system32\config\systemprofile\AppData\Local\Temp
when Bamboo is ran by Local SYSTEM
account.
Resolution
Use any one of these resolution:
- Run Bamboo using a Windows User that has write permission over the tmp directory
Specify a different tmp directory by using this startup parameter (
C:\tempDir
being the example directory):-Djava.io.tmpdir=C:\tempDir
Refer to this documention to learn how to add the Java parameter to Bamboo startup: Configuring your system properties
MSBuild may also fail to write it's own internal response files with an error similar to the following:
CSC : error CS2011: Error opening response file 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\tmpda9899f8f94b49a38838306682d671e8.rsp'
Setting the Java temp directory will not change this as that only affects where the initial response file via Bamboo is created. To override the temp directory used by MSBuild you would need to change the environment variables TMP and TEMP. You can do this in the MSBuild Task in Bamboo within the Environment Variables field: E.g. TMP="c:\path\to\temp" TEMP="c:\path\to\temp
This error might also happens when using MSBuild 15 on a 64bits environment.
Bamboo will often only detect the 32bits executable which's usually at the following path:
X:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
You may want changing it to the MSBuild 64bits version which's usually at the following path:
X:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe