Re: Nant 0.90 Problem with C# Script

Ron Grabowski <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Out of curiosity, why was this changed? Doesn't VS include System.dll by default?



----- Original Message ----
From: Gert Driesen <[email protected]>
To: Ryan Boggs <[email protected]>; Simon H <[email protected]>
Cc: [email protected]
Sent: Tue, May 18, 2010 5:36:03 AM
Subject: Re: [NAnt-users] Nant 0.90 Problem with C# Script

Hey Simon,

This is due to a (breaking) change in 0.90 (more specifically, 0.90 alpha
1).
You need to explicitly add a reference to the System assembly.

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

Gert

-----Original Message-----
From: Ryan Boggs [mailto:[email protected]] 
Sent: dinsdag 18 mei 2010 6:39
To: Simon H
Cc: [email protected]
Subject: Re: [NAnt-users] Nant 0.90 Problem with C# Script

Hey Simon,

If I remember correctly, System.Text.RegularExpressions namespace is
no longer imported in script by default anymore.  You probably need to
include the namespace manually but I can say for certain since I don't
know what's in your NAnt script.

Try adding this to your script tag:

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

Hope this helps,

Thanks,
Ryan

On Mon, May 17, 2010 at 9:23 PM, Simon H <[email protected]> wrote:
> Hi guys,
>
> I have a C# script within my NAnt script that works perfectly in NAnt
0.85.
> It imports the namespace System.Text.RegularExpressions for the purposes
of
> testing user input. However, when I try to run my build file using NAnt
0.90
> I get an error (see below). I have noted that NAnt 0.85 targetted the .NET
> 2.0 framework by default whereas NAnt 0.90 targets .NET 3.5 framework.
> However, I have tried running the build file after changing the default
> framework to .NET 2.0 and still get the same error. Any ideas? Thanks in
> advance!
>
> Compilation failed:
> c:\Documents and Settings\xxx\Local Settings\Temp\amfegm-q.0.cs(18,19) :
> error CS0234: The type or namespace name 'RegularExpressions' does not
exist
> in the namespace 'System.Text' (are you missing an assembly reference?)
>
>
//--------------------------------------------------------------------------
----
> // <auto-generated>
> //     This code was generated by a tool.
> //     Runtime Version:2.0.50727.1433
> //
> //     Changes to this file may cause incorrect behavior and will be lost
if
> //     the code is regenerated.
> // </auto-generated>
>
//--------------------------------------------------------------------------
----
>
> using NAnt.Core;
> using NAnt.Core.Attributes;
> using System;
> using System.Collections;
> using System.Diagnostics;
> using System.IO;
> using System.Text;
> using System.Text.RegularExpressions;

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.