How to set output directory for C ++ project created by msbuild?

I have a MSBuild.proj file that compiles a mixture of C # and C ++ projects.

C # projects compile output (.exe / .dlls) into OutputPath, which I specify, but when I specify OutputPath for C ++ projects (which calls vcbuild.exe), OutputPath is ignored and instead goes to the directory specified in the Property Pages for .vcproj.

Here is my MSBuild task:

    <MSBuild Projects="$(SourceFolder)\$(NativeSolutionName)"
             Targets="$(BuildTargets)"
             Properties="Configuration=$(Configuration);PlatformName=Win32;OutputPath=$(ToolsOutputDir)">
    </MSBuild>

How can I indicate that C ++ output files should go to the same directory as C # $ output files (ToolsOutputDir)?

+3
source share
1 answer

I was able to complete this work by doing the following:

1) Install Microsoft SDC MSBuild Task Library

2) ++ $(OutputPath).

3) SDC OutputPath ++ VCBuild:

    <Microsoft.Sdc.Tasks.SetEnvironmentVariable Variable="OutputPath" Value="$(ToolsOutputDir)" Target="Process"/>

    <!-- Build any CPP code x86 -->
    <MSBuild Projects="$(SourceFolder)\$(NativeSolutionName)"
             Targets="$(BuildTargets)"
             Properties="Configuration=$(Configuration);PlatformName=Win32;OutputPath=$(ToolsOutputDir)">
    </MSBuild>
+1

All Articles