Monday, April 26, 2010

Xml Document Transform (XDT) Snippets for VS 2010

During my PDC talk I had shown some of the snippets that can come handy while using Web.Config Transformations…  This post is intended to share the XDT snippets and instructions on how to install them to use them with VS 2010…


  • After this the XDT snippets will be available for you to use within any XML file within VS 2010…

To know how to use XDTs for Web.Config file please check out the post about Web.Config Transformations

Few interesting points about Transforms & Locators which are worth noting to do pretty powerful stuff with your XML are:

  • Transforms  - Transforms act on a XML node i.e. from XDT engine standpoint the node on which a transform is found is plucked out of the document and passed as a node to the Transform itself (e.g. “SetAttributes” Transform)… The Transform class internally implements the logic of modifying the node with its own special logic (i.e. setting attributes in case of “SetAttributes” Transform) and returns back the node to the engine…  The XDT engine then replaces the new node into the document…  The engine also passes the handle of the parent node to the transform which the transform can then play around with (e.g. “Insert” Transform receives a new node as well as the parent node and has the DOM code of inserting the new node under the parent…)


  • Locators – XDT usually traverses through the XML document and constructs the XPath all along e.g. when it hits the add node under connectionStrings in web.config it has already constructed the XPath (/configuration/connectionString/add)…  Locators help with narrowing down the XPath so that the correct node can be picked up… Check out the example below:
<add name="1stDB"
connectionString="Data Source=Server1;Initial Catalog=DB1;Integrated Security=True"
xdt:Transform="SetAttributes" />
<add name="2ndDB"
connectionString="Data Source=Server2;Initial Catalog=DB2;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

Based on the standard logic of XPath traversing XDT will always pick up the first “add” node i.e. one with 1stDB in the example below… That may not be always desirable…  In XDT we could have implemented the logic to do special things for appSettings & connectionStrings but then that would have made XDT specific to web.config instead we implemented Locators which now allows XDT to be general purposes XML transformation engine…  In the above example if we use a Locator called xdt:Locator=”Match(name)” on the 2ndDB then as soon as the XDT engine encouters a locator it calls the class implementing it (i.e. “Match” and allows it to play with the XPath that is being generated… In this case the match locator will help construct the XPath as /configuration/connectionString/add[@name=’2ndDB’]


The high level takeaway here is that when you play around with the snippets for XDT keep the above concepts for Transforms & Locators in mind and with the quick snippet explanations of each transforms and locators you should be able to very easily use all of them… If you encounter any issues plz feel free to reach out…



Friday, April 16, 2010

Web Deployment Projects Released to Beta (WDP for VS 2010)


Our team recently released WDP for VS 2010… The key features to note for WDP for VS 2010 are:

  1. All the core features of WDP 2008
  2. Migration from WDP 2008 to WDP 201o
  3. Multi-Targeting support in WDP 2010
  4. Support Web Deploy Packages in the WDP project..

You can read more about the above features on our team blog at Visual Web Developer Team Blog

Download WDP 2010 Beta by clicking here!!

The guidance around using WDP 2010 is

  • Use it if you want to migrate to VS 2010 and are currently using WDP for VS 2008
  • Use it for TeamBuild/MSBuild based deployment of Web Site Projects in VS 2010…
  • Use them for Web Application Projects (WAPs) if you feel it is extremely important for you to pre-compile/merge your projects… If not then you can use Web Deployment features built into VS 2010

Hope this helps!!


Thursday, April 15, 2010

Web Deployment Demos, Slides & Videos for VS 2010 launch

I have been dormant for ever, have been keeping busy on a very exciting project… Anyways April 12th 2010 was a big day with VS 2010 formally launching…  Few days back I asked Twitter whether people needed a ready made talk to talk about VS 2010 Web Deployment as part of the community launch events of VS 2010 and got a lot of asks for the content so here it is… 

Titles & Abstract I would recommend you do not use are below… :-)  The reason I say that is coz VS 2010 & Web Deploy are way more exciting than the way I present here; so get creative and make a fun abstract & title…  The only reason I have them descriptive is so that you know what are the key items to put in there…

Title: Web Deployment with VS 2010 & Web Deploy

Abstract: Web deployment is not as easy as it should be; whether you are deploying to a shared hosting environment or to your company’s web servers there are a lot of manual steps involved.  Check out how new VS 2010 and Web Deploy can help you deploy your web along with its dependencies like databases and IIS settings to any environment with just One Click Publish.  Also check out how  you can transport your entire web in a single .zip file and finally hear all about the web.staging.config, web.release.config etc  and the simple transformation syntax in them to create web.config per deployment configuration… Finally also learn how you can automate your Web Deployments using Team build so you no more have to worry about daily builds and setting up of environments…

Video:  Check out the video at, this should prep you up on what are the talking points…

Demos & Slides: You can download it from my SkyDrive

If you have any questions/thoughts on the content you can feel free to write comments here or reach me at @VishalRJoshi 

Hope this helps!!