I need a c# program that opens up a NANT BUILD file, it then goes out and edits the following text in the file:
In the file I need to change db_server = "whatevervalue" to equeal db_server = ""
db_user = "whatevervalue" to db_user = ""
db_password = "whatevervalue" to db_password = ""
the above values exist in a nant build file that I need to modify so that another build file can change the values of the "whatevervalue" to equal somthing else when the build is executed. This needs to be done in a c# program
Thank You!
HOW TO UPDATE A BUILD FILE using c#
Moderator: SourceGear
Re: HOW TO UPDATE A BUILD FILE using c#
This is outside the scope of Vault, but could you use <replacestring> within a filterchain within a NAnt script to make the change to that second script?
Jeff Clausius
SourceGear
SourceGear
-
- Posts: 2
- Joined: Wed Jan 12, 2011 10:40 am
Re: HOW TO UPDATE A BUILD FILE using c#
I have done exactly this but the problem is that there is NO NANT way of removing the values inside of the quoted string because it could be anything such as: DB_SERVER = "SERVERNAME1" if i was to use the replacestring it would look like this:jclausius wrote:This is outside the scope of Vault, but could you use <replacestring> within a filterchain within a NAnt script to make the change to that second script?
<filterchain>
<replacestring from='db_server =' to='db_server = "${db.server}"' />
So with the above code your result would look like: db_server = "oldservername" "newservervalue"
and you can see that I ONLY want to change the value of "oldservername" the replacestring does replace the vaule but it needs to pad everthing to the RIGHT of the "servername1" with blank space (air) nothing blank
Thanks!
Re: HOW TO UPDATE A BUILD FILE using c#
Hmm... I don't know if you have control over this, but in Vault's build, we do things like code the following in some of the variable type files:
server='SSSSSSSSS'; PWD='PPPPPPPPP'
Then those strings are replaced during the build by NAnt.
Again, I don't know if you have control over those files in your situation, but if not, perhaps others can offer their solutions.
server='SSSSSSSSS'; PWD='PPPPPPPPP'
Then those strings are replaced during the build by NAnt.
Again, I don't know if you have control over those files in your situation, but if not, perhaps others can offer their solutions.
Jeff Clausius
SourceGear
SourceGear