Sam
Sam

Reputation: 1525

TFS 2018 build fails: cannot open include file 'afxres.h'

We are testing a new new TFS 2018 SP1 server.

I was previously building a solution (4.5) which contains two unmanaged C++ projects originally written against the 2012 toolset.

Building that solution as-is on the new server worked fine. However, we have decided to retarget to 4.7.1 for our next release.

After making all the changes in the projects including targeting the 4.7.1 framework and the 2017 toolset (141), these projects fail to build with the error in the title.

I know this has to do with the C++ MFC/ATL redist.

The build server does not have VS 2017 installed and I do not want to install it unless absolutely necessary.

I did install the VS 2017 C++ redists x86 and x64 but it did not correct this.

Can anyone help me on that?

Upvotes: 1

Views: 2601

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30392

You need to at least install Build Tools for Visual Studio 2017 on your build server.

Build Tools for Visual Studio 2017

These Build Tools allow you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support, and .NET and .NET Core support.

If that still not work, I'm afraid that you have to install the VS 2017 on the build server. (Note that do not miss the feature Microsoft Foundation Classes for C++ .)


UPDATE:

Please double check if you missed the Microsoft.VisualStudio.Workload.VCTools workload on the build server. See Visual C++ build tools for details.

If missed , just try using below command to install it:

vs_buildtools.exe --add Microsoft.VisualStudio.Workload.VCTools

Upvotes: 1

Related Questions