Re: [NAnt-users] editing a VBP
Hi Bob, I have had to do this in the past for various reasons (binary compatibility, setting versions to specific values, etc.) and I was never able to find a suitable way to do it with nant alone. Ultimately, I ended up writing a vbscript that would do the work for me and then I would just call it from my build scripts. Hope this helps, Mike From: Bob Archer [mailto:bob.arc...@amsi.com] Sent: Thursday, April 23, 2009 4:15 PM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] editing a VBP I need to modify the contents of a .vbp file. A .vbp file is pretty much like an ini file. I tried iniwrite but it requires that I enter the section value. While there are sections in the vbp file most of the settings are not in a specified section? Is there aren't way I can tell it root or no section? Or, any other quick and dirty ways to modify a vbp file. I want to set the MajorVer, MinorVer and RevisionVer values. Thanks, BOb -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects___ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users
Re: [NAnt-users] editing a VBP
The only things I could think of was to use a filterchain with a replacestring filter. However, there don't seem to be any wildcards or regex capabilities there. I guess I could just do it the hard way, read each line of the file looking for those lines and modifying them and then write the file out. I'm pretty sure that will work, but it just seems excessive. If no one else has any suggestions I will go with that. BOb From: Michael Pento [mailto:mpe...@metratech.com] Sent: Friday, April 24, 2009 6:38 AM To: Bob Archer; nant-users@lists.sourceforge.net Subject: RE: [NAnt-users] editing a VBP Hi Bob, I have had to do this in the past for various reasons (binary compatibility, setting versions to specific values, etc.) and I was never able to find a suitable way to do it with nant alone. Ultimately, I ended up writing a vbscript that would do the work for me and then I would just call it from my build scripts. Hope this helps, Mike From: Bob Archer [mailto:bob.arc...@amsi.com] Sent: Thursday, April 23, 2009 4:15 PM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] editing a VBP I need to modify the contents of a .vbp file. A .vbp file is pretty much like an ini file. I tried iniwrite but it requires that I enter the section value. While there are sections in the vbp file most of the settings are not in a specified section? Is there aren't way I can tell it root or no section? Or, any other quick and dirty ways to modify a vbp file. I want to set the MajorVer, MinorVer and RevisionVer values. Thanks, BOb -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects___ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users
Re: [NAnt-users] editing a VBP
Or, any other quick and dirty ways to modify a vbp file. I want to set the MajorVer, MinorVer and RevisionVer values. For this specific task, we use a combination of a custom regex function, and the loadfile, property and echo tasks. The script: script language=C# prefix=regex code imports import namespace=System.Text.RegularExpressions/ /imports ![CDATA[ [Function(replace)] public static string RegexReplace(string pSource, string pSearch, string pReplace) { RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline; Regex re = new Regex(pSearch, options); return re.Replace(pSource, pReplace); } ]] /code /script The nant target: target name=vb6versioning description=Set version information in VB6 applications. failonerror=true loadfile file=${projectFileName} property=project.file / property name=ex value=MajorVer *= *[0-9]*[\r\n]*$ / property name=newvalue value=MajorVer=${buildnumber.major} / property name=project.file value=${regex::replace(project.file, ex, newvalue)} / property name=ex value=MinorVer *= *[0-9]*[\r\n]*$ / property name=newvalue value=MinorVer=${buildnumber.minor} / property name=project.file value=${regex::replace(project.file, ex, newvalue)} / property name=ex value=RevisionVer *= *[0-9]*[\r\n]*$ / property name=newvalue value=RevisionVer=${buildnumber.build} / property name=project.file value=${regex::replace(project.file, ex, newvalue)} / property name=ex value=AutoIncrementVer *= *[0-9]*[\r\n]*$ / property name=newvalue value=AutoIncrementVer=0 / property name=project.file value=${regex::replace(project.file, ex, newvalue)} / echo message=${project.file} file=${projectFileName} / /target A bit brute force, but, it works for us. Brad -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users