This project is read-only.

How do I add a COM tlb as a reference?

May 23, 2013 at 1:20 AM
If I add mscoree.tbl as a reference I get the following:
§ projects:\ConsoleApplication2\References>ls Interop.mscoree|select *


SSItemMode        :   ~<      
PSPath            : studioshell\PSDTE::solution\projects\ConsoleApplication2\References\Interop.mscoree
PSParentPath      : studioshell\PSDTE::solution\projects\ConsoleApplication2\References
PSChildName       : Interop.mscoree
PSDrive           : projects
PSProvider        : studioshell\PSDTE
PSIsContainer     : False
SpecificVersion   : True
ContainingProject : CodeOwls.StudioShell.Paths.Items.ProjectModel.ShellProject
Name              : Interop.mscoree
Type              : prjReferenceTypeActiveX
Identity          : {5477469E-83B1-11D2-8B49-00A0C9B7C9C4}\2.4\0\tlbimp
Path              : c:\users\justin\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\Interop.mscoree.dll
Description       : Common Language Runtime Execution Engine 2.4 Library
Culture           : 0
MajorVersion      : 2
MinorVersion      : 4
RevisionNumber    : 0
BuildNumber       : 0
StrongName        : False
SourceProject     : 
CopyLocal         : False
PublicKeyToken    : 
Version           : 2.4.0.0
But I'm not sure how to New-Item that.
May 23, 2013 at 1:28 PM
Two choices:

1) specify the type library guid as a string in the -name parameter, along with the major version number of the object in the -majorversion custom parameter for the references collection and an item -type of COM; optionally you can include a -minorversion number and a -locate identifier:

new-item -path dte:\solution\projects\consoleapplication2\references -name '{5477469E-83B1-11D2-8B49-00A0C9B7C9C4}' -majorversion 2 -type com

this method is difficult to use because you need to know the GUID for the type library beforehand.

2) specify the full path to the TLB, dll, ocx, etc file:

new-item -path dte:\solution\projects\consoleapplication2\references -value c:\path\to\tlbfile.tlb

Note that for COM interop wrappers, the first method is your only choice.
May 25, 2013 at 6:52 PM
For the second form I had to add -Type ActiveX like so
New-Item -Path DTE:\Solution\Projects\ConsoleApplication1\References -value C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscoree.tlb -Type ActiveX
Thanks!!!
May 25, 2013 at 7:29 PM
Two more things,

Do you think there is a place in the documentation to list how to manipulate references to include this. do you think that belongs in about_StudioShell_Drives.help.txt or in another file?