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?
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:
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
And I can use my desired Tlbim.exe using Windows default environment variables for "C:\Program files" folder as:
"%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:
"$(ProgramFiles(x86))\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64\Tlbimp.exe"
Hope you got the idea...