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.

4 Comments

  • So, is this a revised version of the MSBuild Compatibility toolkit that you're working on? I'd love a solid solution for targeting the 1.1 Framework with VS2K5.

  • Yes. It's the release of the MSBuild Compatibility Toolkit targeted at VS2005 Beta 2. Hopefully I'll be finished with it soon.

  • Robert -



    Yes, the MSBuild object model in the beta2 release still has some excess stuff in it that will be removed before RTM. Some types and methods, including your personal favorite GetDirectlyImportedProjects(), won't exist in the final MSBuild object model. They were redundant "convenience" API's. Anything you could do with those you can still do with the fundamental object model that remains. We weren't able to do this refactoring before beta2.



    As for accessing the MSBuild instance that VS is using, there is no way to do this.



    We appreciate your feedback -- keep it coming!



    Chris Flaat

    MSBuild Team

  • Chris,



    Thanks so much for your comments. I just wanted you and your team to know that MSBuild is really great. Interacting with it can be difficult, especially for what I want to do with it.



    It's good to know that you guys are making changes... I'll be looking forward to them. Thanks!



    -Robert

Comments have been disabled for this content.