Last post May 28, 2010 02:54 PM by ming chen
May 27, 2010 01:43 PM|Jubu|LINK
Hi, I'm a newbie in ASP.NET and right now my web application is almost finished.
I have a little issue, I need to modify a connection string in a class in my app_code folder when the setup is running.
I know that I need a Custom Action for this, but I have no idea in how the code must be.
Does anyone can give me a reference on this?
May 27, 2010 04:31 PM|MayankSri|LINK
Could you please elaborate your problem a little?
I think you are trying to set a specific connection string based on the environment, is that the case?
The best place to keep connection string would be the web config. Please refer to this article -
Also, for deployment purpose, you should maintain different web configs for different environments.
In case you are using .NET 4.0 / Visual Studio 2010, the studio can do some pretty cool stuff for you in this regard.
May 27, 2010 06:27 PM|Jubu|LINK
Thank you for your reply MayankSri,
Yes, I have in this class a connection string as a string variable.
I already have a custom action in my web setup to edit my connection strings in my web.config, I just want to edit the connection string in this specific class just like it does in web.config.
May 28, 2010 02:54 PM|Ming Chen|LINK
This is long standing for the "web setup". This is where the new msdeploy that VS10 leverage have much more flexibility by its deploy time parameter.
In VS10, we support the msdeploy which allow the deploy time parameters.
It just so happen VS leverage the Parameter to perform on the xml file (web.config.)
You can do the same thing with a class file, with the "TextFile" as scope, which by default use the "Regex" for the match.
Now, all you need to do is extending Web Publish Pipeline to also handle your special class....