Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a VS2010 C++ Project on a BuildServer

I've a .NET Solution with a managed C++ assemlby Targeting .NET 3.5 created with VS2010. The command:

%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln

compiles the solution on my dev machine.

On my BuildServer I get this error:

Build FAILED.

"F:\CruiseControl.NET\Projects\MyProject\MyProject.sln" (default target) (1) -> "F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj" (default target) (2) -> "F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj" (default target) (3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

0 Warning(s)
1 Error(s)

On my dev machine the claimed file

"C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"

exists. On my build server not.

When I try to copy this files (and all others in the same directory) other errors occurred. So this is the wrong way.

EDIT: other errors means: When I copy the file "Microsoft.Cpp.Default.props" on the build server, MSBuild is claiming other files. That shows me, that just doing a copy of missing files is not what the build environment is expecting. I am looking for an MSI/whatever package that I could install on my build server and any C++ Project will build. Installing the SDK did not the trick. Or I did something wrong during SDK installation. Or it is not possible to compile Managed C++ VS2010 Solutions just with the SDK.

I believe that "other errors" has nothing to do with my problem. My Problem is: "How do I setup my build environment correctly". /EDIT

What I've done till now:

  • I have installed the latest Win7 SDK (http://blogs.msdn.com/b/windowssdk/archive/2010/05/25/released-windows-sdk-for-windows-7-and-net-framework-4.aspx)
  • I am targeting .net 3.5
  • I've tried playing with the Platform Toolset Property - but it was just playing
  • In my solution there is a managed C++ Assembly (my Problem)
  • I am using MSBuild 4.0 because the new VS2010 project files cannot be compiled with MSBuild 3.5
  • I am using CC.NET. compilation fails in CC.NET and on the command line. So it should not be a CC.NET issue.

Are there any tips and tricks how to configure my project properly to compile on my dev machine with VS2010 and on my build server? Is there anything more to install (except VS2010)?

Thanks, Arthur

like image 687
Arthur Avatar asked Jun 15 '10 07:06

Arthur


Video Answer


1 Answers

For now, installing VS 2010 is your only safe option. The Windows SDK will be updated to enable your scenario, but I don't have a specific release date. Until then, you'll need to install VS 2010 with the C++ tools in order to build your 2010 solution with C++ projects. Make sure you let the C++ team know about how dissatisfaction with this situation via their team blog and/or MSDN Forum.

Even after installing VS 2010, you may need to invoke the appropriate vcvars*.bat file to setup your environment variables correctly.

like image 100
Jim Lamb Avatar answered Sep 29 '22 05:09

Jim Lamb