Well, Visual Studio 2005 Beta 2 is finally out the door. It is certainly a high-quality Beta, but, like any piece of software, not without it’s flaws. You may notice that if you install MSDN (which I’m sure most users do), the Visual Studio Addin Wizard produces broken projects. That’s the bad news. The good news is that we are definitely aware of the problem, it will be fixed by the final version, and there are a few simple workarounds you can do to get around it. You may see two ambiguous errors after building a C# addin with a “Tools” menu item stating that “The best overloaded method match for ‘EnvDTE80.Commands2.AddNamedCommand2(EnvDTE.AddIn, string, string, string, bool, object, ref System.Array, int, int, EnvDTE80.vsCommandControlType)’ has some invalid arguments” and “Argument ‘7’: cannot convert from ‘ref object’ to ‘ref System.Array'”.
The details about exactly why this happens are not worth getting into, but basically what happened is that Visual Studio cannot find the Primary Interop Assembly that’s been installed to allow you to communicate with Visual Studio through managed (.NET) code. However, VS does see the COM information that is exposed and attempts to use COM-interop to generate a primary interop assembly on-the-fly for you. It gets pretty close, but VS guesses that it should be using a System.Array when it should be using a object in the PIA. This causes the build error that you see. Oops.
The bug is currently being tracked in the MSDN Product Feedback Center. There are currently two viable workarounds for the bug. The first workaround (repairing references) will fix any projects that you may have already created and need to repair. The second workaround will actually repair the wizard so that it can reference the correct assembly. This is the preferred and more reliable workaround. Hopefully this workaround will help you on your way to building the next great addin for Visual Studio 2005!