$ (TargetPath) not calculated when loading a macro?

I have a file custom.propswhere I define the macro that will be used in the project. In this example, I have the following:

<VST2_32_COMMAND_ARGS>$(TargetPath) /noload /nosave /noexc /noft</VST2_32_COMMAND_ARGS>

When I load a project and I look at Properties, Debugging, Argument Arguments, I can access this macro VST2_32_COMMAND_ARGS. But the string is evalutated as/noload /nosave /noexc /noft

In principle, $(TargetPath)not evaluated. In my case, this path points to a DLL, so there should be something like this:

"C:\Program Files (x86)\VstPlugins\Plug\vst2\Win32\bin\MyPlug.dll" /noload /nosave /noexc /noft

But its empty. How can i fix this? Also tried this:

<VST2_32_COMMAND_ARGS>"$(TargetPath)" /noload /nosave /noexc /noft</VST2_32_COMMAND_ARGS>

but the result:

"" /noload /nosave /noexc /noft
+4
source share
1 answer

$ (TargetPath) not evalutated when loading a macro?

, custom.props Microsoft.Cpp.targets:

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="Custom.props" />

, , Microsoft.Cpp.Current.targets:

  <Target Name="SetUserMacroEnvironmentVariables" 
          Condition="'@(BuildMacro)' != '' and '$(DesignTimeBuild)' != 'true'">

    <SetEnv Condition="'%(BuildMacro.EnvironmentVariable)' == 'true'"
        Name   ="@(BuildMacro)"
        Value  ="%(BuildMacro.Value)"
        Prefix ="false">
      <Output TaskParameter="OutputEnvironmentVariable" PropertyName="%(BuildMacro.Identity)"/>
    </SetEnv>

  </Target>

Microsoft.Cpp.Current.targets Microsoft.Cpp.targets:

 <Import Condition="'$(_Redirect)' != 'true'" Project="$(VCTargetsPath)\Microsoft.Cpp.Current.targets" />

, , - Microsoft.Cpp.targets, MSBuild .

.targets :

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets

VST2_32_COMMAND_ARGS, . , :

  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>

  <Import Project="Custom.props" />

  <Target Name="TestByCustom" AfterTargets="Build">
    <Message Text="$(VST2_32_COMMAND_ARGS)"></Message>
  </Target>

$(TargetPath):

enter image description here

custom.props:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
   <VST2_32_COMMAND_ARGS>"$(TargetPath)" /noload /nosave /noexc /noft</VST2_32_COMMAND_ARGS>
  </PropertyGroup>

</Project>

, .

+1

Source: https://habr.com/ru/post/1693813/


All Articles