MSBuild and $(ProgramFiles) issue with 32/64 bits

后端 未结 2 821
我在风中等你
我在风中等你 2021-02-08 13:50

I wrote a custom MSBuild task which calls SubWCRev.exe, an executable which (typically) resides in C:\\Program Files\\TortoiseSVN\\bin, whether it\'s 3

2条回答
  •  深忆病人
    2021-02-08 14:11

    Use MSBuildExtensionsPath property instead of hardcoding the path.

    Per MSDN:

    The MSBuild subfolder under the \Program Files\ or \Program Files (x86) folder. This path always points to the Program Files of the same bitness as the window you are currently running in. For example, for a 32-bit window on a 64-bit machine, the path is to the Program Files (x86) folder. For a 64-bit window on a 64-bit machine, the path is to the Program Files folder. See also MSBuildExtensionsPath32 and MSBuildExtensionsPath64.

    Edit: To get to the 64 bit SVN folder, use :

    
       $(MSBuildExtensionsPath64)\..\TortoiseSVN\bin
    
    

    Another way is to check for existence of folders:

    
      $(PROGRAMFILES) (x86)\TortoiseSVN\bin
      $(PROGRAMFILES)\TortoiseSVN\bin
    
    

提交回复
热议问题