SharePoint GUID Collision Avoidance
SharePoint developers working in Visual Studio 2010 know that GUID collisions can be a needless nuisance. Brian Watts sent along this tip that he got from one of Doug Ware's
tutorials on SharePoint. Brian adds a pre-deployment command to his Visual Studio build-deploy-debug process that deletes and recreates his SharePoint site before he does any testing. Brian says he can't remember the last time he had a problem with a GUID clash.
To make this happen, in your SharePoint 2010 project, go into the Properties window, select the SharePoint tab, and add the following code to the pre-deployment Command Line box at the top of the window:
stsadm -o deletesite -url <url for his site>
stsadm -o createsite -url <url for his site>
-owneremail <your email>
-ownerlogin <your admin id, including the domain name>
-siteTemplate "STS#1"
-description "A test site"
-title "Test Site"
Brian says it might be adding a couple of seconds whenever he presses F5, but that delay is more than worth the benefits of avoiding any problems.
Do you have a Visual Studio tip, you'd like to share? Send it to me at [email protected].
Posted by Peter Vogel on 03/29/2011