MSBuild Include Paths Frustrations

2,164 views
Skip to first unread message

seffyroff

unread,
Sep 10, 2008, 11:44:14 AM9/10/08
to ccnet-user
Hi again guys,

I'm attempting to build a C++ project from a .sln which has multiple
projects in it, using MSBuild. when I try and run MSBuild from teh
commandline with my sln file, Configuration and Platform settings, it
errors out because it can't find things like cstdio, d3d9, windows.h
etc.

I've Googled and Googled and Googled and can't seem to find a way to
give MSBuild Include paths on the commandline. Anybody experienced
this? Am I approaching this wrong somewhow?

Alex

unread,
Sep 10, 2008, 9:27:34 PM9/10/08
to ccnet-user

I never really found a working solution for this and ended up giving
up on MsBuild 2.0.5727 with C++ projects. However if you can use
MsBuild 3.5 you will find Microsoft ironed out all the C++ kinks. The
only exception I have found is you can not build 64 bit targets with
the multicore flag.

seffyroff

unread,
Sep 11, 2008, 6:23:55 AM9/11/08
to ccnet-user
I'm calling msbuild.exe from the Windows\Microsoft.NET\Framework\v3.5\
directory, and still getting these errors, so either I have something
set up wrong or MS didn't Iron out all the C++ kinks :(

I can't seem to find anything relevant on the net related to this
issue, which makes it all the more frustrating, as I feel I must be
doing something wrong that everyone else got right!

Anyone successfully managed to get a C++ .sln with multiple projects
in it to successfully build with CCNet? Alex, you seem to suggest you
have done so - I'm not doing any multicore flag stuff, just a debug
build targeted for Windows DirectX.

Here's my specific commandline:

C:\SVNProject\Project\Source>c:\windows\Microsoft.NET\Framework
\v3.5\MSBuild.exe Project.sln /p:Configuration=Debug /
p:Platform=DirectX /v:diag

I've tried adding various things like "/p:"VCBuildAdditionalOptions=/
useenv" and "/p:ReferencePath=pathtoincludedheaders" etc but none of
those things appeared to make any difference.

Best regards,

Phil

Desai, Anand

unread,
Sep 11, 2008, 6:39:20 AM9/11/08
to ccnet...@googlegroups.com
Hi,

Are you sure that you are using .Net Framework 3.5 for this?

Can you send the command line output when you try to run this command?

-Anand

Best regards,

Phil


==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================

seffyroff

unread,
Sep 11, 2008, 6:52:16 AM9/11/08
to ccnet-user
Hi Anand,

Thanks for your reply.

You might be onto something there - when I run

C:\SVNProject\Project\Source>c:\windows\Microsoft.NET\Framework
\v3.5\MSBuild.exe /?

I get:

Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3053]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

I tried running it with /toolsversion:3.5 and it returned the same
thing. I have .net Framework 3.5SP1 installed. What am I missing?


Phil.

On Sep 11, 11:39 am, "Desai, Anand" <anand.de...@credit-suisse.com>
wrote:

Desai, Anand

unread,
Sep 11, 2008, 6:57:32 AM9/11/08
to ccnet...@googlegroups.com
Phil,

Based you the information below, it seems that you are using the appropriate version of MSBuild. Now, can you confirm that you C++ project is compiled using the same version of .net Framework?

i.e. do you have project in your solution which are compiled using different version of .net Framework?

Alex

unread,
Sep 11, 2008, 7:43:46 AM9/11/08
to ccnet-user
One thing I am curious about, can you compile this solution on this
machine with the exact same configuration and target using Visual
Studio? This is a good test to make sure this machine is right.
Because, I am compiling C++, solutions that utilize DirectX and other
3rd party libraries that are scattered around my machine, and my calls
to MsBuild are no different then yours. If it works through Visual
Studio, then your next test would be to run it from the Visual Studio
command line, not the regular one. If both of these pass, and the
regualr command line fails then that my tell us something.

seffyroff

unread,
Sep 11, 2008, 7:57:35 AM9/11/08
to ccnet-user
When working on the project, I compile within Visual C++ Express
2008. The include files that MSBuild is complaining about are things
like cstdio (a standard C++ library) - I've tried adding the include
directories to the system path also. This didn't help. As far as I'm
aware, I'm not using any features of the .net framework that would
require building.

Best regards,

Phil.

On Sep 11, 11:57 am, "Desai, Anand" <anand.de...@credit-suisse.com>

Desai, Anand

unread,
Sep 11, 2008, 7:57:43 AM9/11/08
to ccnet...@googlegroups.com
I agree with Alex's suggestion.

Desai, Anand

unread,
Sep 11, 2008, 8:00:23 AM9/11/08
to ccnet...@googlegroups.com
Phil,

I don't think that adding it to system path will help. See if you can do what Alex has suggested. That should point you in the right direction.

seffyroff

unread,
Sep 11, 2008, 10:45:16 AM9/11/08
to ccnet-user
Unfortunately I haven't been able to get it to build from the
commandline, but this is a separate issue. I'm using Visual C++ 2008
Express Edition, which doesn't include a devenv.exe commandline
builder. Apparently VCExpress.exe does the same thing from the
commandline but I've never managed to get it to do anything. It just
returns me to a prompt after hitting enter. Asking it to Log gives no
helpful information.

The solution does build from within VCExpress IDE on the same machine
however.

seffyroff

unread,
Sep 11, 2008, 11:45:37 AM9/11/08
to ccnet-user
Slight update - I tried running MSBuild from within a 'Visual Studio
2008 Command Prompt' and got MUCH further. It didn't totally solve my
problem, it did sucessfully compile the solution but failed when it
tried to link d3dx9.lib.

The error from MSBuild is:

LINK : fatal error LNK1104: cannot open file 'd3dx9.lib'

That file resides on the machine in "C:\Program Files\Microsoft
DirectX SDK (March 2008)\Lib\x86".

So that brings 2 questions to mind:

How do I show it where to find d3dx9.lib?
and
How do I emulate the environment of a Visual Studio Command Prompt
from within a CCNet MSBuild Task?

Thanks for your support guys!

Phil

Alex

unread,
Sep 11, 2008, 2:16:47 PM9/11/08
to ccnet-user
To show it where the d3dx9.lib, set it up through the IDE as a Library
path. On Visual Studio this would be tools\options\Projects and
Settings\ C++ Directories. As for getting CC.Net to emulate the vs
command prompt; it just seems to..I have never had an issue once I got
it running from the vs2008 commmand prompt. One question though you
are building it through the express IDE but you also have the visual
studio command prompt? does that come with the express? or do you have
both products installed? I am wondering if perhaps you have some
wierdness where even though you use express, because you have VS2008
installed MSBuild is somehow getting its environment form the wrong
tool?

seffyroff

unread,
Sep 15, 2008, 4:28:51 AM9/15/08
to ccnet-user
Yep, I already had all the paths set in the IDE for Includes, Libs
etc. I don't have VS Pro installed but i do have VS2005 Express
installed for a couple of older projects. VS2008 Express has a VS2008
Command Prompt which calls a 'vcvars32.bat' batch file, setting up a
bunch of environment variables. The Dx libs aren't listed in there.
However, neither are the Dx headers, and it compiles fine

I actually installed VS2005 Express after in installed VS2008 Express,
so I wonder whether 2005 has screwed up something.

I shall investigate further this week. Hope everyone had a great
weekend, thanks for your replies!

Phil.

seffyroff

unread,
Sep 25, 2008, 10:14:35 AM9/25/08
to ccnet-user
Hi guys,

Looks like I've gotten this working. In order to do so I had to add
the path to d3dx9.lib (C:\Program Files\Microsoft DirectX SDK (March
2008)\Lib\x86) into the additional libraries paths setting for the
linker, on the projects right click/properties menu. This still
confuses me as VC2008 doesn't fail without this, yet MSBuild does.

Colour me confused...

Cheers,

Phil
Reply all
Reply to author
Forward
0 new messages