0

I want to run a prebuild target which I'm coding up in a csproj. This needs to run tlbimp to produce a dll my project references.

I'm trying to exec tlbimp, but am getting errors that it can't be found. Is there an msbuild variable or environment variable I can use to deduce the path to it?

4

2 回答 2

2

使用 MSBuild 12 (VS2013),

$(TargetFrameworkSDKToolsDirectory)

指着

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

tlbimp.exe

"$(TargetFrameworkSDKToolsDirectory)tlbimp.exe"

这是在哪里定义的?

于 2014-08-29T09:43:13.027 回答
1

可能没有直接变量,但您可以使用一些内置变量来构造路径。在我的机器上,我在多个位置都有 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 。可执行程序

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

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

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

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

希望你有这个想法...

于 2013-11-12T10:50:38.033 回答