Archives / 2005 / May
  • 'About Box' forms, the 'My' Namespace, and Class Libraries

    In Visual Studio 2005, there is a built-in form called the "About Box". In a VB.NET project, you can add it to your application, and it will automatially display the info that you put in your AssemblyInfo file for the user. It's a pretty neat little addition that makes it just a little bit easier to build an app.

    But, as far as I can tell, you can't use it in Class Library projects. Why would you want to? Well, the underlying project type for a Visual Studio Add-in is a Class Library. When you try to display an About Box form as part of a Visual Studio add-in, it will throw an error without warning. That's because, for some reason, the initialization of the My namespace is not passing in the executing assembly to the My.Application.Info default constructor (which maps to Microsoft.VisualBasic.ApplicationServices.AssemblyInfo).

    The simple solution is to replace the AboutBox_Load code with the code below:

    1    Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2 Dim info As New Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(System.Reflection.Assembly.GetExecutingAssembly)
    4 ' Set the title of the form.
    5 Dim ApplicationTitle As String
    6 If info.Title <> "" Then
    7 ApplicationTitle = info.Title
    8 Else
    9 ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(info.AssemblyName)
    10 End If
    11 Me.Text = String.Format("About {0}", ApplicationTitle)
    12 ' Initialize all of the text displayed on the About Box.
    13 ' TODO: Customize the application's assembly information in the "Application" pane of the project
    14 ' properties dialog (under the "Project" menu).
    15 Me.LabelProductName.Text = info.ProductName
    16 Me.LabelVersion.Text = String.Format("Version {0}", info.Version.ToString)
    17 Me.LabelCopyright.Text = info.Copyright
    18 Me.LabelCompanyName.Text = info.CompanyName
    19 Me.TextBoxDescription.Text = info.Description
    20 End Sub

    Basically, I've added a new line to instantiate the AssemblyInfo class manually, and then replaced My.Application.Info with info. The form will then work as it is supposed to.

    I've filed this as a bug, but I have a feeling it may not get fixed... so keep this workaround handy in case you need it.



    I try not to post non-technical stuff here, but I'm still working on my new personal site, and my personal blog is down, so I thought I'd post it here.

    I just got back from seeing Episode III, and I haven't stopped talking about it. It was BY FAR the best of all the Star Wars movies. I felt like a little kid watching it. I knew what was going to happen, but I found myself (on more than one occasion) saying "Annie, don't do it!" Oh, it was so cool.

    I used to read every day. But I saw the screenplay for EPII way early, and it totally ruined that movie for me. After that, I swore I wasn't going to touch that site until after I saw EPIII. So, in their old tradition, and spoiler-related stuff will be in white text, and you'll have to highlight it to read it.

    (Highlight text for spoiler-related material)

    So in the part where Palpatine is telling Anakin about that Sith legend. I think he was talking about his master in that story. He had mentioned that this Sith Lord was so powerful, he could even use the Midichlorians to create life. I think that Palpatine's master specifically created Anakin to become his apprentice, but Palpatine became obsessed, killed his master, and took on Darth Maul as his apprentice. He then set up a chain of events that he foresaw the outcome on, as to make Anakin his pawn.

    But the coolest thing is, I can't hate Darth Vader anymore. After Palpatine manipulated him, and lied to him about Padme, Obi-Wan kicked the crap out of him, and he was burned alive, you can't help but feel sorry for him. He had all the power in the world, but was powerless to stop his own destiny.

    At the end of the day, I can't help but wonder what George feels like right now. He's waited over 30 years to be able to tell this story. What would that be like to have to wait that long to complete something? He spend millions of dollars of his own money, just because he wanted to tell us a story. That's pretty damned cool, IMO.

    The movie is incredible. Go see it, even if you feel you've been jaded by the last two. This one made putting up with Jar-Jar worth it ;).


  • Disappointed with the MSBuild Object Model

    I've been working pretty heavily with MSBuild over the last few days. Overall, I love the idea of a universal build engine, and I've been really excited to wrap up this idea that's been in my head ever since I saw it in August 2003.

    But the actual implementation of the MSBuild API is, IMO, terrible. It feels like it was built by Windows API guys, especially when you get into the Microsoft.Build.Engine.Project class. Instead of having read-write properties for things like directly-imported projects, there are methods like "GetDirectlyImportedProjects". That's all well and good, but I can't bind against that. I can't add and remove items from a collection... it's just poor API design. Now that they're in Beta 2, the problem now is that they are stuck with this API, and if the MSBuild team were to clean it up in the next version, they'd have to keep the other messy stuff for a while.

    The idea was good, but some of the Object Model feels like it was a rushed prototype that never got the polish that it should have.

    It doesn't help that the VS2005 object model is not much better. I can't for the life of me figure out how to access the MSBuild instance that VS uses for the loaded project. There is a ton of excess code in the add-in project stub code, and there is no documentation on the names of the various toolbars and menus to be able to add items to them.

    All in all, though, the technology is great. I figured out (for the most part) what I wanted to accomplish. I just hope they make another pass and improve the APIs on MSBuild.


  • Adding Constructors to WinForms in .NET 2.0

    Properties aren't always necessary for WinForms. Sometimes, I like to create alternate constructors and pass the information in through a parameter to a private member.

    In VS2003, this worked without incident. My forms were always displayed just fine. However, in VS2005, when I displayed the form, it was the default size, and didn't have any controls. I spent about 30 minutes trying to track down why I was getting NullReferenceExceptions trying to bind to to a DataGridView, and the form was blank. I finally had to crack open Reflector and see that the compiler wasn't as nice to me as it used to be.

    I filed this as a bug in the MSDN Product Feedback Center, so if you can reproduce it, please vote on it.


  • MSDN Universal Gets Team Foundation Server 2005!!!

    I just got this from Tim Heuer, the MS Developer Evangelist for Phoenix, and I thought I'd pass it along directly. It is really big news, IMO. Any emphasis is mine.

    It is not often that we receive direct communication to the community from Corporate VP's at the big ship... but yesterday we received one that contains great news regarding a situation of MS listening to the feedback of the community and reacting.  Below are excerpts from a memo from Sanjay Parthasarathy (affectionately called "Sanjay P"), who is the Corporate VP of .NET strategy (translation: "the man").

    We announced our product line and pricing in March, significantly ahead of product availability. What we heard from customers time and again was that they wanted Microsoft to provide as much advance notice as possible regarding product changes. Since the March announcement, we have received quite a bit of feedback about the SKU strategy, pricing and licensing.

    [You]  have been an invaluable source of input on these topics and we are taking action to respond to many of your suggestions.

    We will place a limited version of Team Foundation Server in each edition of the Visual Studio Team System family (Architects, Developers and Testers). This version will be restricted to a maximum of five users and should serve the needs of smaller organizations. Teams that have a need for more users should still find that Team Foundation Server is significantly more cost effective than current source code control solutions and offers tremendous value through its role as the core of integration across all of the Team System.

    To address the broader feedback on pricing, we have also finalized promotional pricing around Team Suite to enable current subscribers to more easily upgrade to the full Visual Studio product line. Going forward into 2005, MSDN Universal customers will have three choices:

    » Universal subscribers that want all of the client functionality of Team System will be able to upgrade to Team Suite by paying just the incremental software assurance or renewal price for the duration of their agreement. In retail, this amounts to around $2,300 and for most customers this represents a 75% or more discount on the full price of Team Suite. Volume customers will, of course, pay less.

    » Universal subscribers who want Team Edition for Software Architects, Team Edition for Software Developers, or Team Edition for Software Testers will be able to upgrade at no additional cost. Each of these "role Editions" includes the MSDN Premium Subscription.

    » Universal subscribers who want the 2005 equivalent of MSDN Universal can simply choose Visual Studio 2005 Professional Edition with MSDN Premium Subscription and get the functional equivalent of MSDN Universal for about 15% less than what they paid today.


    And people say Microsoft doesn't pay attention to feedback! This is great news for small .NET shops who want to develop like the pros. Now there's more reason than ever to join the Empower program for ISVs (if you're an ISV, of course).


  • Robert and the Lockergome Talk Windows - Part 2

    From "The Chris Pirillo Show":

    The Robert McLaws interview continues in the second part with more great information about Longhorn, 64-bit versions of Windows, the future of the Windows user experience and Robert's take on why many people (including Chris) came away feeling let down by the version of Longhorn presented at WinHEC. Robert packs a ton of great information into this interview, covering topics ranging from why Windows 2003 Server offers better application throughput than Windows XP to what people should really expect in the next version of Windows. Of course, you can stay current on all of Robert's thoughts on Longhorn at Longhorn Blogs.

    Listen to Part 2 here.


  • Robert & the Lockergome Talk x64 and Longhorn

    From "The Chris Pirillo Show":

    Robert McLaws delivers some of the best information outside of Redmond on the next generation of Microsoft's operating system through his Longhorn Blogs site. This is no fanboy prostrating himself at the throne of Gates - McLaws is equally quick to criticize and praise, but seems to focus primarily on distilling the hype and breaking down the real dirt on what's coming to your desktop sometime before 2010. While attending the WinHEC conference, Robert was a prisoner house guest at Chris's place, presented with the option of either telling all he knew about Longhorn and the x64 future of Windows or be serenaded by the Time Life collection, Soothing Sounds of Water Torture. This is the first part of Robert's interview with Chris, proving that he eventually caved, choosing to talk rather than listen to the steady stream of dripping liquid.

    Listen to Part 1 here.


  • The VS2005 SDK Needs A Lot Of Work

    Have you ever tried to build an addin for Visual Studio? I'm working on one right now, and it's not much fun. I was hoping the VS2005 SDK (formerly VSIP) would be a bit more user-friendly than the previous versions... but I was wrong.

    Microsoft should really take a look at Jamie Cansdale's ManagedAddin Framework. He's done a great job of making it dirt simple to write an add-in. Hopefully Jamie will update his code to run on VS2005.