[英]What's the msbuild path to Exec tlbimp from a csproj?
I want to run a prebuild target which I'm coding up in a csproj. 我想运行一个在csproj中编码的预构建目标。 This needs to run tlbimp to produce a dll my project references.
这需要运行tlbimp以生成我的项目引用的dll。
I'm trying to exec tlbimp, but am getting errors that it can't be found. 我正在尝试执行tlbimp,但是却收到无法找到的错误。 Is there an msbuild variable or environment variable I can use to deduce the path to it?
我可以使用msbuild变量或环境变量来推断出它的路径吗?
There might not be a direct variable, but you can use some built-in variables to construct the path. 可能没有直接变量,但是您可以使用一些内置变量来构造路径。 As on my machine, I have tlbim.exe in multiple locations:
在我的机器上,我在多个位置都有tlbim.exe:
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\TlbImp.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 \\ 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 \\ 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 \\ 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 \\ TlbImp.exe
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\x64\\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 \\ TlbImp.exe
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Bin\\x64\\TlbImp.exe C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v6.0A \\ Bin \\ x64 \\ TlbImp.exe
And I can use my desired Tlbim.exe using Windows default environment variables for "C:\\Program files" folder as: 而且我可以使用Windows C的默认环境变量“ C:\\ Program files”文件夹使用所需的Tlbim.exe:
"%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\x64\\Tlbimp.exe" “%ProgramFiles(x86)%\\ Microsoft SDKs \\ Windows \\ v8.0A \\ bin \\ NETFX 4.0 Tools \\ x64 \\ Tlbimp.exe”
In Msbuild projects, you will have to use $(var) instead of %var%, so it should be like: 在Msbuild项目中,您将不得不使用$(var)而不是%var%,因此它应该类似于:
"$(ProgramFiles(x86))\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\x64\\Tlbimp.exe" “ $(ProgramFiles(x86))\\ Microsoft SDKs \\ Windows \\ v8.0A \\ bin \\ NETFX 4.0 Tools \\ x64 \\ Tlbimp.exe”
Hope you got the idea... 希望你有主意...
With MSBuild 12 (VS2013), 使用MSBuild 12(VS2013),
$(TargetFrameworkSDKToolsDirectory)
points to 指着
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\
ie tlbimp.exe
is at 即
tlbimp.exe
在
"$(TargetFrameworkSDKToolsDirectory)tlbimp.exe"
( Where is this defined? ) ( 在哪里定义? )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.