I ran into this and wrote a simple generic regex-replace task:
<target name="StringFunctions">
<script language="CSHARP" prefix="string" >
<code>
<![CDATA[
[Function("regex-replace")]
public static string RegexReplace(string strInput, string
strRegex, string strReplace)
{
System.Text.RegularExpressions.RegexOptions options
= ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace
| System.Text.RegularExpressions.RegexOptions.Singleline) |
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
string result = Regex.Replace(strInput, strRegex,
Regex.Unescape(strReplace), options);
return result;
}
]]>
</code>
</script>
</target>
For your purpose, you can call it like this:
<target name="UpdateAssemblyInfo">
<call target="StringFunctions" />
<loadfile file="AssemblyInfo.cs" property="contents" />
<echo file="AssemblyInfo.cs"
message="${string::regex-replace(contents,
'AssemblyVersion\("\d+\.\d+\..+?"\)', 'AssemblyVersion("'
+ ver.config + '")')}" />
</target>
e
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Nielsen.Allan Rene Dystrup AND
Sent: October 20, 2005 11:27 AM
To: [email protected]
Subject: [Nant-users] Patch version number in AssemblyInfo.cs
Hi guys,
I'd like to parse my AssemblyInfo.cs file for :
[assembly: AssemblyVersion("0.2.0.0")]
and substitute the version (in casu: 0.2.0.0) with a current version# in
property ${ver.config).
I've looked at the nant task
<copy> with <filterchain> and <replacestring but it doesn't quite cut
the cheese.
What would be really nice was a regular expression filtering/
substitution, but I haven't found one.
Any suggestions?
Thanks & best regards/
allan
________________________________________________________________________
_______________
www.kmd.dk www.kundenet.kmd.dk www.eboks.dk www.civitas.dk
www.netborger.dk www.organisator.dk
Hvis du har modtaget denne mail ved en fejl vil jeg gerne, at du
informerer mig og sletter den.
KMD skaber it-services, der fremmer effektivitet hos det offentlige,
erhvervslivet og borgerne.
If you received this e-mail by mistake, please notify me and delete it.
Thank you.
Our mission is to enhance the efficiency of the public sector and
improve its service of the general public.
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads,
discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users