【问题标题】:What's the msbuild path to Exec tlbimp from a csproj?从 csproj 到 Exec tlbimp 的 msbuild 路径是什么?
【发布时间】:2013-10-08 17:04:43
【问题描述】:

我想运行我在 csproj 中编写的预构建目标。这需要运行 tlbimp 来生成我的项目引用的 dll。

我正在尝试执行 tlbimp,但出现无法找到的错误。是否有一个 msbuild 变量或环境变量可以用来推断它的路径?

【问题讨论】:

    标签: c# msbuild tlbimp


    【解决方案1】:

    使用 MSBuild 12 (VS2013),

    $(TargetFrameworkSDKToolsDirectory)
    

    指向

    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\
    

    tlbimp.exe

    "$(TargetFrameworkSDKToolsDirectory)tlbimp.exe"
    

    (Where is this defined?)

    【讨论】:

      【解决方案2】:

      可能没有直接变量,但您可以使用一些内置变量来构造路径。就像在我的机器上一样,我在多个位置都有 tlbim.exe:

      C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\TlbImp.exe
      C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\TlbImp.exe
      C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\TlbImp.exe
      C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64\TlbImp.exe
      C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\TlbImp.exe
      C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\TlbImp.exe
      C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\TlbImp.exe
      C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\TlbImp.exe

      我可以使用我想要的 Tlbim.exe,使用 Windows 默认环境变量作为“C:\Program 文件”文件夹:

      “%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\Tlbimp.exe”

      在 Msbuild 项目中,你将不得不使用 $(var) 而不是 %var%,所以它应该是这样的:

      "$(ProgramFiles(x86))\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\Tlbimp.exe"

      希望你明白了……

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-03-19
        • 1970-01-01
        • 1970-01-01
        • 2013-05-27
        • 2010-09-24
        • 2011-10-22
        • 1970-01-01
        • 2023-01-12
        相关资源
        最近更新 更多