How do I set a property to the output of a command in msbuild/xbuild
        Posted  
        
            by Nils
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nils
        
        
        
        Published on 2010-04-21T05:58:42Z
        Indexed on 
            2010/04/21
            6:03 UTC
        
        
        Read the original article
        Hit count: 318
        
In msbuild/xbuild I'd like to have a "libPath" property which can be ovveridden on the commandline using /p:libpath="/path/to/all/libs". But when this property is undefined I want to call pkg-config --retrieve-Path somePackage to get the current systems path.
I thought like here I need the output of a command to be stored in a Property.
The command always returns one line of output.
I have tryied something like
<PropertyGroup>
  <LibPath />
</PropertyGroup>
<Task ....>
  <Exec Command="pkg-config --retrieve-Path somePackage"
        Condition="$(LibPath)' == ''">
   <OutputTaskParameter="output"
          PropertyName="LibPath" />
  </Exec>
</Task>
But that didn't work.
© Stack Overflow or respective owner