问题描述:

i am writing a MSBuild script which compiles a C++ file using MSBuild CL Task, something like:

<CL Sources="c:\temp\myfile.cpp" />

How do i control where the output (myfile.obj) goes? By default, it goes to the path from where the script is present (and also happens to be the path from where i run the script): i.e. if i run the script (c:\someFolder\build.proj) from "c:\someFolder\" then myfile.obj is placed at "c:\someFolder\myfile.obj".

Going by a wild (illogical) guess, i also tried fidgeting with OutDir property(?!), something like:

<PropertyGroup>

<OutDir>d:\somePlace\<OutDir>

</PropertyGroup>

...

<CL Sources="c:\temp\myfile.cpp" />

Didn't work.

网友答案:

The answer to the original question about how to control the output of the CL task is by using the ObjectFileName argument (as provided by Hans Passant).

However, it now seems that using a minimum standard vcxproj is a better idea (as suggested by both stijn and Hans Passant).

相关阅读:
Top