NAnt 0.86, script task with RegEx and RegularExpressions

image Muah.  While updating to NAnt 0.86, I was stuck with the following error while trying to execute a <script> task:

The name 'Regex' does not exist in the current context

I was using a <script> task to do some RegEx some files apart of the build process.  Well, turns out that NAnt 0.86-beta2 has a breaking changeSystem.Text.RegularExpressions is now removed by default from the imported assemblies of <script> tasks.  Oh well...

The following should get you back on track:

  641     <script language="C#">

  642           <code>

  643 <![CDATA[

  644         //C# code goes here...

  645   ]]>

  646           </code>

  647         <imports>

  648             <import namespace="System.Text.RegularExpressions"/>

  649         </imports>

  650         <references>

  651             <include name="System.dll"/>

  652         </references>

  653     </script>

Just add the <imports> and <references> section to the <script> task and all should be well again! :)

Brian Chavez

One Comment Filed Under [ Errors ]

Comments

# re: NAnt 0.86, script task with RegEx and RegularExpressions
Gravatar Thank you much you saved my day
Left by Seethalakshi P on 7/24/2012 2:57 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Please add 2 and 8 and type the answer here:

Preview Your Comment.