Groups > Asp .Net > Visual Studio 2005 > Re: Post publish batch file automation




Post publish batch file automation

Post publish batch file automation
Tue, 1 Apr 2008 06:06:33 +0000
hello

every time i publish my website i must delete my 'Web.Config' file which applies
only for my local machine. then afterwards i rename my 'Web.Config.Remote' file
to Web.Config'. i was wondering if there is any way i can auto execute a batch
file after publishing to save myself performing these repetitive tasks?

thanks
Post Reply
Re: Post publish batch file automation
Tue, 1 Apr 2008 09:46:14 +0000
One thing you can do is to declare the appsettings part of your config file as
follows

<appSettings file="web.custom.config">
   <add key="keyName" value="localValue" />
</appSettings>

You can then add into the root folder on your server a file name
web.custom.config which contains

<appSettings>
   <add key="keyName" value="serverValue" />
</appSettings>

With the settings which should be used on the server that you want to replace
those in the configuration file.

If you arent holding your settings in the appsettings but instead are using the
my.settings stuff then i am not sure that you can do this though.
Post Reply
Re: Post publish batch file automation
Wed, 2 Apr 2008 11:38:46 +0000
Hi,

There are usually a couple of web.config files for debugging, testing or
deployment in the project. This is the common issue for developer to change the
web.config for each other.  

Fortunately, you can use the Web Deployment Projects to pevent it. The feature
that comes with Web Deployment Projects is used to create pluggable
configuration files, in other words, you can define the different web.config
file for different version . For more information, see
http://msdn2.microsoft.com/en-us/magazine/cc163448.aspx

 

I hope this helps.
Post Reply
about | contact