Saturday, June 19, 2010

Visual Studio 2010, Web.Config Transformations and the Broken Bits

For those of you who are deploying web applications using the new Visual Studio 2010 features in the RTM version, keep these issues in mind when you are using the new web.config transformation features:

xdt:transform="Replace" attributes don't work properly

If you are are using application settings with a .net Project, you'll find that the XML will actually stored the value in an element rather than as a attribute. When you try to apply the "Replace" tranform on this, you'll find that the result after publishing changes the value from this


to this


Unfortunately, this actually adds the spaces to the end of your value, and the only way round it at the moment is to actually modify your code with a string.Trim() function to ignore the additional spaces. This probably also occurs anywhere you have an element representing a value rather than an attribute representing a value in your web.config.

For more information, see here and here for more information on the issue.

xdt:transform="XSLT" does not exist and is not valid although documented!

When you have a look at the documentation around the web.config transform, you'll find that there's this excellent feature where you can have a standard XSLT transform. Well, it looks like it was accidentally omitted from the final release of Visual Studio 2010, because when you go to use it, the syntax is not recognized at all, in fact it gives you this message:

"Could not resolve 'XSLT' as a type of Transform".

You can find more information about the issue here.



No comments: