Bugs item #1947694, was opened at 2008-04-21 12:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1947694&group_id=31650
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: 0.86
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Michael Kusmiy (dammar)
Assigned to: Nobody/Anonymous (nobody)
Summary: C# XML parsing code with RegEx fails running on NAnt 0.86.29
Initial Comment:
C# XML parsing code with RegEx fails running on NAnt 0.86.2962.0
I installed the NAnt 0.86 (Build 0.86.2962.0; nightly; 10.02.2008) because bug
1859708 was fixed there. After that following C# code crashes while runs OK on
NAnt-0.85 and NAnt-0.86-beta1.
<property name="BuildNumber" value="2.0.0.0" />
<property name="BuildDate"
value="${string::substring(datetime::to-string(datetime::now()), 0,
2)}-${string::substring(datetime::to-string(datetime::now()), 3,
2)}-${string::substring(datetime::to-string(datetime::now()), 6, 4)}"/>
<property name="filepath" value="c:\projects\GlobalAssemblyInfo.cs"/>
<property name="filevss" value="${vssprojects}/GlobalAssemblyInfo.cs"/>
<script language="C#">
<imports>
<import namespace="System.Xml"></import>
<import namespace="System.Xml.XPath"></import>
</imports>
<code><![CDATA[
public static void ScriptMain(Project project)
{
string fileVersion = Path.Combine(project.BaseDirectory,
project.Properties["filepath"]);
StreamReader reader = new StreamReader(project.Properties["filepath"]);
string contents = reader.ReadToEnd();
reader.Close();
string replacement = string.Format(
"[assembly: AssemblyVersion(\"{0}\")]",
project.Properties["BuildNumber"]);
string replacement2 = string.Format(
"[assembly: AssemblyFileVersion(\"{0}\")]",
project.Properties["BuildNumber"]);
string replacement3 = string.Format(
"[assembly: AssemblyInformationalVersion(\"{0}\")]",
project.Properties["BuildDate"]);
string newText = Regex.Replace(contents, @"\[assembly\s*:
AssemblyVersion\("".*""\)\]", replacement);
string newText2 = Regex.Replace(newText, @"\[assembly\s*:
AssemblyFileVersion\("".*""\)\]", replacement2);
string newText3 = Regex.Replace(newText2, @"\[assembly\s*:
AssemblyInformationalVersion\("".*""\)\]", replacement3);
StreamWriter writer = new StreamWriter(fileVersion, false);
writer.Write(newText3);
writer.Close();
}
]]>
</code>
</script>
The code execution fails with the same errors on both machines with .Net SDK
and without it. Errors are as follows:
error CS0234: The type or namespace name 'Xml' does not exist in the namespace
'System' (are you missing an assembly reference?)
If <imports> … </imports> is omitted, nAnt returns following error (builds ok
on previous nAnt releases):
error CS0103: The name 'Regex' does not exist in the current context
Thanks for grate product, but please fix this issue or specify a workaround.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1947694&group_id=31650
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
nant-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-developers