Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / March 2006

Tip: Looking for answers? Try searching our database.

VS 2005 cast back to Microsoft.Office.Core.CommandBars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
j@thewolfweb.com - 24 Mar 2006 18:27 GMT
With all of the VS 2005 DTE methods returning System.Object rather than
x.x.x.CommandBars, I assumed this was for backwards compatibility.
However, I'm getting an InvalidCastException on the following lines of
code in 2005 when CommandBars is from the Microsoft.Office.Core
namespace in the office interop assembly:

// TODO discrepancy 2003/2005 office or vs command bars assembly
CommandBars commandBars = (CommandBars)this.Application.CommandBars;

I reflected the assembly and saw that the COM GUIDs for the CommandBars
classes are different ... Does this mean I'm out of luck in trying to
use a single codebase for both 2003 and 2005?  This line of code is
only one of hundreds that I would have to conditionally compile two
versions of!

Jake
Carlos J. Quintero [VB MVP] - 27 Mar 2006 09:25 GMT
Yes, there are two different assemblies for commandbars, one for VS.NET
2002/2003 and another for VS 2005. You are better off using a single
codebase but using conditional compilation to produce two binaries. Although
it could be possible to use a single binary, you would have to use late
binding and you would be unable to use the new VS 2005 extensibility stuff.

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> With all of the VS 2005 DTE methods returning System.Object rather than
> x.x.x.CommandBars, I assumed this was for backwards compatibility.
[quoted text clipped - 12 lines]
>
> Jake

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.