14

In our team, the devs all have Visual Studio 2012, and we also use TFS2012 build. For space & manageability reasons, we don't install Visual Studio on our (many) build agents. This has worked so far with C# projects (csproj).

Now we want to add support for C++ project (vcxproj). These build on devs' machines, but not on the build agents - we get: X.vcxproj(31,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

I suppose this is because the C++ compiler & targets are only installed with VS.

  1. Is there a way to checkin just the compiler & targets, and set some property in our common.targets to point there?
  2. Failing that, what is the minimum I need to install on each build agent to support C++ compilation? The least I could find was VS Express, which is still too much to my liking.
3
  • Did you check if it's not something stupid like a bad solution file? Commented Mar 14, 2013 at 12:58
  • Yes. My machine has VS installed, and therefore has c:\Program Files (x86)\MSBuild\Microsoft.Cpp. The build agent doesn't have that folder. Commented Mar 14, 2013 at 13:08
  • 1
    Have you installed msbuild on the build agents? The other thing we needed was $(win_sdk)\include as additional include directory. Commented Mar 14, 2013 at 13:23

2 Answers 2

14

It is simple for C#, the ability to compile C# programs is innate in the framework, System.CodeDom, so just installing .NET is enough. Not so for C++. You'll at a minimum need to install the Windows SDK, half a gig. This includes the C++ compiler in SDK versions earlier than 8.0

However, you'll next get to fret about finding a way to get the class libraries on that machine. ATL and MFC for example. You can't just copy them, that violates the license. Much worse, Microsoft is not doing business the way they used to. They switched to a rapid-release cycle since VS2012 with updates shipping in a manner of months. These are not updates you can ignore, they add pretty major chunks to get C++11 implemented. Definitely the kind that your C++ programmers will want to use.

In general, the SDK version of the C++ compiler is just not in sync with VS version, the Windows team has no obligation to keep it updated. The one thing that a build machine should never do is run a different set of build tools than the ones used by the programmers. That makes a build break that can't be reproduced by a dev a big nasty point of contention. Unless you like making your life complicated, the message is clear. Don't do it, install VS.


UPDATE: since writing this post, Microsoft came up with an attractive solution to the problem. Releasing the "Build Tools for Visual Studio" package. Current download page is here, but it moves around so google the product name to chase it. The license permits usage for anybody that has a valid license to a Visual Studio edition or wants to use it to test/release an open source product.

Sign up to request clarification or add additional context in comments.

Comments

0

This problem was also present for earlier TFS versions. As far as I know the only solution is copying the targets to the agents. It should be enough creating a copy of this folder:

MSBuild\Microsoft\VisualStudio\v11.0\*.*

At least you do not have to install Visual Studio on the agents (except you want to automate setup project creation).

The error got also described here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.