MSBuild tasks try to use c:\Windows as a temporary folder, instead of under the user's TEMP dir
-
Friday, August 17, 2012 9:42 AM
Hi,
I have a couple of solution files, with c# and c++ projects, that build fine on one PC, but fail on another, using the same steps, if launched from a command line. I thought I'd figure this out with a bit of detective work, but was proven wrong.
The machine that fails:
- Windows 7, 32 bits OS
- Visual Studio Express for C# and C++
- It had VS2011 Beta installed previously, but was removed, thoroughly I think.
C# and C++ projects compile OK within respective VS Express. However the command line msbuild fails:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(2079,9): warning MSB3491: Could not write lines to file "C:\Windows\.NETFramework,Version=v4.0.AssemblyAttributes.cs". Access to the path 'C:\Windows\.NETFramework,Version=v4.0.AssemblyAttributes.cs' is denied. [C:\src\hydropackage\branches\rClrDev\packages\rClr\src\ClrFacade\ClrFacade.csproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(153,5): error MSB6003: The specified task executable "CL.exe" could not be run. Failed to create a temporary file. Temporary files folder is full or its path is incorrect. Access to the path 'C:\Windows\52194b3717c7413ab81196bad29ac649.tmp' is denied.
It does look like an attempt to use c:\windows as a temp directory (which thankfully fails...). I cannot trace why it is so; it should be a subdirectory of my temp path. It is run with my credentials, with the temp env variable defined. The build is launched from cygwin, but there is no visible difference between the suceeding and failing PC:
TEMP=/tmp
temp=C:\Users\xxxxxx\AppData\Local\Temp
DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
COMMONPROGRAMFILES=C:\Program Files\Common Files
tmp=C:\Users\xxxxxx\AppData\Local\Temp
I got as far as figuring out that something may be going wrong in the following in Microsoft.Common.Targets, but I am baffled. Surely Path.GetTempPath would not return c:\Windows in any circumstance.
Any hint/light shed would be appreciated.
<TargetFrameworkMonikerAssemblyAttributesPath Condition="'$(TargetFrameworkMonikerAssemblyAttributesPath)' == ''">
$([System.IO.Path]::Combine('$([System.IO.Path]::GetTempPath())','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))
</TargetFrameworkMonikerAssemblyAttributesPath>
For background, the machine that succeeds
- Windows 7, 64 bits OS
- Visual Studio Pro 2010
- SDK for Windows and .net, v 7.1
- Had VS2011 Beta installed previously
Cheers
All Replies
-
Monday, August 20, 2012 7:32 AMModerator
Hi jm75,
I think the file "C:\Windows\.NETFramework,Version=v4.0.AssemblyAttributes.cs" is created in TEMP folder and you have no permissions to edit it.
However in another machine, you have the permissions to edit it. So it can be compiled sucessfully.
I think you can modify the directory in your project file as your own path but not the system path.
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us
- Edited by Ego JiangMicrosoft Contingent Staff, Moderator Monday, August 20, 2012 7:33 AM
- Marked As Answer by Ego JiangMicrosoft Contingent Staff, Moderator Tuesday, August 28, 2012 7:35 AM
- Unmarked As Answer by jm75 Saturday, September 29, 2012 11:13 PM
-
Tuesday, August 28, 2012 7:35 AMModerator
Hi jm75,
I marked my reply as answer.
Please unmark it, if you feel it is not the answer.
Thank you for your understanding and support.
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us
-
Saturday, September 29, 2012 11:20 PM
Hi Ego Jiang,
I do not understand your reply
A file under c:\temp cannot be named "C:\Windows\.NETFramework,Version=v4.0.AssemblyAttributes.cs"; this is just plain invalid as a short file name, and this not the issue I describe.
Both the compilations of the Csharp and Cpp projects try to write files/directories under c:\windows. I tried to figure out on my own why this would be the case, but am no MSBuild guru.
Regards,
J-M
-
Friday, January 11, 2013 9:38 PM
For information if someone bumps into some similar issue: after quite a bit more investigation, the issue was traced down to a 'make' utility not picking up the TEMP directory from the cygwin process, and .NET's Path.GetTempPath ending up returning "c:\Windows". See comments to http://r2clr.codeplex.com/workitem/10 for information on how to figure out these things with diagnosing MSbuild.- Marked As Answer by jm75 Friday, January 11, 2013 9:38 PM

