views:

49

answers:

1

I was playing with writing a Visual Studio Add-In in F# and I was following along with some stuff that Gabriel Culliver and Brian McNamara had posted in response to this question.

When I put the following code into a .fs file in VS 2010

namespace TestFSharpAddIn
    open System
    open Extensibility
    //open EnvDTE
    //open EnvDTE80
    do()

It gives me the following error when I attempt to build:

The namespace or module 'Extensibility' is not defined

I have added a reference to Extensibility.dll so I'm assuming that the namespace within the Extensibility dll is not "Extensibility". But it doesn't seem to be possible to open the Extensibility dll in the Object Browser. Am I missing something obvious here? How can I find out which namespaces are present in Extensibility.dll?

I also tried this with EnvDTE with pretty much the same issue.

The project is a modified C# template (per Brian's answer) and I can comment out everything in this .fs file and it builds so I think the project/solution itself is ok. There's a second .fs file in the project which builds fine but, of course, it doesn't need to reference any of the EnvDTE or Extensibility assemblies.


EDIT:

Additional Information:

Extensibility.dll

Version 7.0.3300.0

Path: C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Extensibility.dll

+2  A: 

I'm not sure what's going on in with your situation but I've verified this works in F#. Here are my steps

  1. New F# application
  2. Add a Reference to the Extensibility DLL

I then added the following code to verify the reference. It compiles cleanly.

open Extensibility
let x : IDTExtensibility2 = null
printfn "foo"

The path I used for the extensibility DLL is

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Common\Extensibility.dll

JaredPar
Thanks Jared. What happens if you put the "open Extensibility" inside a namespace? Everything still ok?
Onorio Catenacci
@Onorio yes that works as well.
JaredPar
@Jared--at the risk of being annoying--which version of Extensibility.dll do you have? The version I've got (7.0.3300.0) lives in a different path altogether: C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Extensibility.dll
Onorio Catenacci
@Onorio, I have the same version. What happens if you try from the path I used?
JaredPar
@JaredPar I don't think I've got the VSTO tools installed. Need to double check that.
Onorio Catenacci