Thursday, July 15, 2010

How to modify Commerce Server 2009 Web Parts

If you’re running Commerce Server 2009 in SharePoint, you’ve likely wanted to modify an out-of-the-box CS web part. This post will show you a shortcut. The normal way to do this is to open the CS extensibility kit (C:\Program Files\Microsoft Commerce Server 2007\Microsoft Commerce Server 2009\Sdk\Samples\CommerceSharePointExtensibilityKit), resign all of the assemblies with your own SNK, and then update every reference everywhere to be aware of your SNK’s public key token. Here’s a forum post that explains this in more detail. When I tried this I missed some references in config files and the site blew up. If you’re working in a production environment, proceed with caution!

The shortcut is to create a new web part that inherits from the base Commerce Server web part and set the UserControlVirtualPath with your own ASCX (copied from the extensibility kit). This obviously limits your options compared to cracking open the full source, but it is a vastly simpler deploy experience that will allow you to at least customize the markup for your creative team.

Take a look at the screenshots below; there shouldn't be too many surprises. One gotcha to bear in mind is that if your control has a <%@ Register Src="ReadOnlyAddressDetail.ascx" ...> directive, you have to add the dependant ASCX files—the web part won’t render without it, and it doesn’t seem to “know” to fall back to the OOB markup.

Once you deploy the web part, you can add yours in place of the stock Commerce Server one. Piece of cake.

Blog

Saturday, July 10, 2010

Home Server Drive Balancer

Check out this great utility for your Windows Home Server, Drive Balancer. It’s designed to rebalance the storage across your pool. It came in handy in my case because I added a new 2TB drive (formerly 4x500GB, now 3x500+1x2TB). I kept waiting for the new drive to start getting files, but that never happened. Then I ripped a Blu Ray and the stupid thing started telling me that there wasn’t enough space to duplicate the new file...grrr...just move some files around and there’s plenty of room!! That’s what this utility does, it solves the literally only gripe I’ve found with this otherwise excellent product.

Be sure to read the readme and walkthrough before you get started. Interestingly, it doesn’t move the files, it just adds blank files in a way that, when triggered by the utility, the built-in file mirroring ends up rebalancing. Definitely add it to your toolkit.