Home Dashboard Directory Help
Search

$(VCTargetsPath) is not defined when building a .vcxproj via MSBuild task by spiderM9


Status: 

Closed
 as By Design Help for as By Design


4
0
Sign in
to vote
Type: Bug
ID: 518281
Opened: 12/4/2009 2:04:33 PM
Access Restriction: Public
0
Workaround(s)
view
4
User(s) can reproduce this bug

Description

I have an msbuild project file that drives our command line build. I've found that vcxproj files do not build when build through the MSBuild task in this "driver" project, even if they build when called directly from MSBuild at the commandline.
Details
Sign in to post a comment.
Posted by MrBarcaVela on 2/18/2011 at 2:56 PM
We got it working after hours of research and detective work.

After cranking up the MSBuild logging, I noticed that MSBuild on the TFS Build Agent machine was using environment variables from our TFS Build Controller server, which was a separate machine.

So, we set the VCTargetsPath on the Build Controller server.

We then ensured that we disabled any Build Agents that were running on machines without Visual C++ 2010.

Now we are able to build Hello World using Team Build.

Adam Bentley
www.bentley-solutions.com
Posted by MrBarcaVela on 2/16/2011 at 10:56 AM
This suggestion did not help our situation. We Created a basic Hello World C++ project with VS2010 and added it to a TFS 2010 Team Project.

When we build the project with msbuild command line, everything works fine.

When we build the project with TFS Team Build, we get C:\Builds\1\AdamTest\AdamHello\Sources\AdamHello\AdamHello\AdamHello.vcxproj (22): The imported project "$(VCTargetsPath)Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Both tests were done using a domain user account. The team build service is running under my domain user account.

We also tried setting system environment variables, but this did not help.
Posted by Microsoft on 12/14/2009 at 8:56 PM
Hi Brian,

Based on the repro steps you specified, this is expected to fail: the C++ build system requires the MSBuild 4.0 engine because of the enhancements made in the MSBuild syntax that the C++ build targets are taking advantage. The solution in this case is to use ToolsVersion="4.0" for all projects (wrapper projects, C++, C#, etc.)

You correctly identified the immediate reason of the failure: VCTargetsPath is a toolset property that is defined in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 so it is not visible in the 3.5 toolset. Even if it were defined there, as i mentioned, parsing of the targets will fail due to the new 4.0 syntax.

Thank you for your report and please keep the feedback coming.
Marian Luparu
Visual C++
Posted by Microsoft on 12/7/2009 at 9:30 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Posted by Microsoft on 12/5/2009 at 1:06 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.