Last post Jan 10, 2014 03:59 PM by mkonanki
Jul 07, 2011 02:16 AM|mfearby|LINK
I can't get the transforms working. I think it was working once, and now it isn't anymore. I don't remember changing anything either. I've recently re-read the documentation and I can't see that I've messed anything up. Here's the relevant part of my web.config:
<add name="MyConnectionString" connectionString="Data Source=MYDB;Initial Catalog=MYDATABASE;Integrated Security=True" providerName="System.Data.SqlClient"/>
And here's my Web.Release.config file, in full:
<add name="MyConnectionString" xdt:Locator="Match(name)" xdt:Transform="Replace" connectionString="Data Source=MYDB;Initial Catalog=MYDATABASE;Integrated Security=True" providerName="System.Data.SqlClient" />
When I build deployment package (with "Release" chosen in the current config) the output directory - C:\MYPROJDIR\obj\Release\Package\PackageTmp - contains the output and a web.config which is completely un-transformed. And since I've been testing and re-testing
it this afternoon, each time I delete the PackageTmp and re-run the build, it re-creates the PackageTmp directory with a web.config file timestamped at over half an hour ago. it's like it's not even bothering to re-create my package anymore, and is still using
a cached copy?
How do I get these transforms to actually work? Am I missing something? Thanks.
Jul 07, 2011 04:26 AM|princeG|LINK
It might help you : http://www.shubho.net/2011/03/transformation-webconfig-aspnet-40.html
Jul 07, 2011 07:39 PM|mfearby|LINK
Thanks for the links. The first one steps me through exactly what I have (though it has SetAttributes and not Replace, but I've tried both and neither will transform the file anyway).
There has to be something else that's needed for these things to work because my resulting .config files are completely untransformed. I have both Release and Debug configurations in configuration manager, and the two related files beneath web.config. When
I want to generate a Debug build, I choose Debug from the drop-down on the toolbar, then generate a build, and try the same for Release. Either way, I'm just getting the exact same web.config, unaltered, copied to the obj directory.
There are about 4 settings I need to change between debug and release, and it's getting to the point where I am sometimes forgetting to change some settings before copying across to production, and suffering the consequences. Which is why I decided I should
finally start using these transforms, to take the human-error component out, yet I apparently have to get over the computer-error first :-(
I did, at one point when they were transforming, albeit with pointless tokens instead of connection strings, change my .vbproj file to the following:
But I don't see how this should stop the transforms from happening. All I've done is tell it to stop swapping out my connection strings with tokens. I've had some involvement with Ant build scripts before and they seemed much less prone to mysterious failures
such as I'm now experiencing with Visual Studio.
Jul 07, 2011 07:48 PM|mfearby|LINK
Mea culpa, mea maxima culpa. There were two instances of <TransformWebConfigEnabled> in my .vbproj, one for Release and another for Debug. I had only changed the one for Debug to True, and not the one for Release. My main web.config connection strings are
the same as Debug anyway, so it was only the Release one that I noticed was a problem.
The dangers of following verbatim somebody else's article to turn off tokenisation of connection strings :-) Hopefully this account of my mistake might help some other poor soul one day.
Jul 29, 2011 12:11 PM|MarvPerk3|LINK
My Mea Culpa may have been even stupider... I kept "Build"-ing the project, expecting that it would do everything that "Publish"-ing does short of deploying it to the destination Web Server. Wrong! "Build" doesn't even touch the web.config transforms
or the package files/folders.
As soon as I used "Publish", there were my transformed web.config files and the entire package folder/file structure.
Now I know to Publish to a local, even if a dummy, folder if I want to see the web.config transforms without pushing to a Web Server environment.
Jul 31, 2011 08:09 PM|mfearby|LINK
Interesting. I've always just gone to (from memory, since I'm at home where I only use Linux) Project > Build Deployment Package, and I've never used Publish before.
Aug 01, 2011 08:51 AM|MarvPerk3|LINK
That, of course, would be the right way to do it. I never saw/used that option from the Project Menu so thanks!
Aug 01, 2011 07:52 PM|mfearby|LINK
I recall reading somewhere that the Publish option might take some of the manual steps out of it (namely, the copying of the files onto the web server) but what ain't broke right now don't need fixin', so I'm leaving well enough alone for now :-)
Jan 10, 2014 03:59 PM|mkonanki|LINK
Please check it under Properties-> SlowCheetah->SlowCheetah.Transforms.targets
SlowCheetah.Transforms.targets this find is required when u r building .