问题
When I'm trying to build my MSVC2010 project with Bamboo's Visual-Studio task, I get the following error:
LINK : fatal error LNK1181: File "C:\Windows\system32\config\systemprofile\AppData\Local\Temp\lnk7A64.tmp" could not be opened.
msdn hast this to say:
If the given file is named LNKn, which is a filename generated by the linker for a temporary file, the directory specified in the TMP environment variable may not exist, or more than one directory is specified for the TMP environment variable. (Only one directory path should be specified for the TMP environment variable.)
So I checked my TMP variable and it has only one directory, which does exist. Actually there is even a file generated, just not the right one. So for example, I start the build, lnk7A64.tmp is created, but the linker looks for lnk7A64.tmp
I only get this error with Bamboo. It works fine with Visual Studio.
Any ideas as to why that happens and how to resolve it?
UPDATE:
I'm beginning to think this may be, because Bamboo can't find the executables needed for creating the right files (ressource compiler maybe). I've described this here before. I thought I could work around that problem, but it seems like it's causing this error too.
回答1:
I had the same issue (which brought me to your question!). I figured out that by default, the bamboo agent service runs as "SYSTEM" and this did not jive with my build. Follow this guide from Atlassian to change the user that your bamboo agent runs as. I did this and it works now. https://confluence.atlassian.com/display/BAMBOO/Running+Bamboo+service+on+Windows+as+the+local+user
回答2:
I was running into a very similar issue:
C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp\lnk{A20CED18-5FC6-4AB0-84C2-B922E8CD543B}.tmp(1): error RC2135: file not found: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp\lnk{E2128AA4-9E0E-48D0-814E-22F9FDD938F9}.tmp [C:\bamboo_home\xml-data\build-dir\Sources\VS2017\Core\Core.vcxproj]
Turns out the build server was using the x86 version of MSBuild at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
Instead of the x64 version at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe
Ugh!
来源:https://stackoverflow.com/questions/15268612/fatal-error-lnk1104-cant-open-lnkn-tmp