Re: C# sharp scripting and NAnt + CCNet

Ryan Boggs <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Hi,

On Apr 21, 2010, at 7:33 AM, Martin Gainty <[email protected]> wrote:

> as a followup to ryan and gert on the build for 0.90
>
> i tried downloading Visual Studio 2010 with .Net Framework 4.0 ..  
> after repeated crashes to my system i had to restore from backup
>
> %NANT_HOME%\src\NAnt.DotNet\Tasks>csc csctask.cs
> Microsoft (R) Visual C# .NET Compiler version 7.00.9951
> for Microsoft (R) .NET Framework version 1.00.3705.6018
> Copyright (C) Microsoft Corporation 2001. All rights reserved.
>
> fatal error CS0007: Unexpected common language runtime  
> initialization error --
>         'Class not registered '
> this is one of those "engine light on" messages from microsoft so  
> pinged the list
>
> ryan suggested that downloading and building mono 2.6.3 will help..  
> so i downloaded mono-2.6.3 for cygwin and when building see this
> %MONO_HOME%\mcs\class\Microsoft.Build.Tasks>make
> make all-local
> make[1]: Entering directory `%MON_HOME%/mcs/class/ 
> Microsoft.Build.Tasks'
> MCS     [net_2_0] Microsoft.Build.Tasks.dll
> make[1]: *** [../../class/lib/net_2_0/Microsoft.Build.Tasks.dll]  
> Error 1
>
>  Directory of %MONO_HOME%\mcs\class\lib\net_2_0
> 03/10/2010  06:55 PM           173,056 Microsoft.Build.Tasks.dll
>
> make[1]: Leaving directory `%MONO_HOME%/mcs/class/ 
> Microsoft.Build.Tasks'
> make: *** [do-all] Error 2
>
> there is no 'do-all' in the %MONO_HOME%/mcs/class/ 
> Microsoft.Build.Tasks/Makefile
>
I don't remember suggesting that but there is nothing wrong with Mono.

Rather than building Mono from scratch, you should download the  
Windows installer. It is much easier and faster than building it via  
cygwin.

 From there, you just follow the instructions in the readme file.

Thanks,
Ryan
> i was considering moving my J2EE project to DotNet but if DotNet  
> software crashes my system then the move decision has been made
>
> Any advice on making build environments work for mono or nant would  
> be gratefully received
>
> thanks,
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentia 
> lité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene  
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede  
> unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.  
> Diese Nachricht dient lediglich dem Austausch von Informationen und  
> entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten  
> Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den  
> Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous  
> n'êtes pas le destinataire prévu, nous te demandons avec bonté que  
> pour satisfaire informez l'expéditeur. N'importe quelle diffusion no 
> n autorisée ou la copie de ceci est interdite. Ce message sert à l'i 
> nformation seulement et n'aura pas n'importe quel effet légalement o 
> bligatoire. Étant donné que les email peuvent facilement être  
> sujets à la manipulation, nous ne pouvons accepter aucune responsabi 
> lité pour le contenu fourni.
>
>
>
>
>
> From: [email protected]
> To: [email protected]
> Date: Wed, 21 Apr 2010 09:22:59 -0400
> Subject: Re: [NAnt-users] C# sharp scripting and NAnt + CCNet
>
> One of the more recent editions of ccnet allows prompting the user  
> for parameters when a  build is forced.
>
> http://confluence.public.thoughtworks.org/display/CCNET/CCNet+1.5+CTP+Release+Notes
>
>
>
> see the “Dynamic Parameters” section.
>
>
>
>
>
> From: Ron Grabowski [mailto:[email protected]]
> Sent: Tuesday, April 20, 2010 11:04 PM
> To: nant
> Subject: Re: [NAnt-users] C# sharp scripting and NAnt + CCNet
>
>
>
> How will ccnet accept user input if its running as a service on an  
> unattended build server?
>
> Can you store the username, password, an database in a database and  
> have the nant script look at that if a console isn't available?
>
>
>
> From: Simon H <[email protected]>
> To: [email protected]
> Sent: Tue, April 20, 2010 10:32:20 PM
> Subject: [NAnt-users] C# sharp scripting and NAnt + CCNet
>
> Hi guys,
> I have a C# script within my NAnt build file which allows me to  
> accept user input from the commandline. A truncutated excerpt of the  
> NAnt build file is:
> ...
> <property name="username"            value="" />
> <property name="password"            value="" />
> <property name="database"            value="" />
> ...
> <target name="menu">
>     <script language="C#" mainclass="GetInput">
>       <code>
>         <![CDATA[
>           class GetInput
>           {
>             public static void ScriptMain(Project project)
>             {
>               Console.Clear();
>               Console.WriteLine 
> ("= 
> ==================================================================");
>               Console.WriteLine("Welcome to the Compile and Deploy  
> Oracle Forms and Reports Facility");
>               Console.WriteLine 
> ("= 
> ==================================================================");
>               Console.Write("Please enter username: ");
>               project.Properties["username"] = Console.ReadLine();
>               Console.WriteLine();
>               Console.Write("Please enter password: ");
>               project.Properties["password"] = Console.ReadLine();
>               Console.WriteLine();
>               Console.Write("Please enter database: ");
>               project.Properties["database"] = Console.ReadLine();
>               Console.WriteLine();
>               ...
>         ]]>
>       </code>
>     </script>
>   </target>
>
> When I run this build file from the commandline, it works perfectly.  
> However, when I call this build file from CCNet it does not work.  
> The only reason for this I can think of is that when CCNet calls the  
> NAnt script, it is not sure how to pass the C# script calls to the  
> System.Console class to the commandline. I'm not sure how to do this  
> though.
>
> I've also been playing around with the idea of the C# script opening  
> a new instance of cmd.exe and then trying to execute the remainder  
> of the script. >From searches on Google, I found the following  
> solution that works as a C# class:
>
> using System;
> using System.Windows.Forms;
> using System.Text;
> using System.IO;
> using System.Runtime.InteropServices;
> using Microsoft.Win32.SafeHandles;
> class Program
> {
>     [DllImport("kernel32.dll",
>         EntryPoint = "GetStdHandle",
>         SetLastError = true,
>         CharSet = CharSet.Auto,
>         CallingConvention = CallingConvention.StdCall)]
>     private static extern IntPtr GetStdHandle(int nStdHandle);
>     [DllImport("kernel32.dll",
>         EntryPoint = "AllocConsole",
>         SetLastError = true,
>         CharSet = CharSet.Auto,
>         CallingConvention = CallingConvention.StdCall)]
>     private static extern int AllocConsole();
>     private const int STD_OUTPUT_HANDLE = -11;
>     private const int MY_CODE_PAGE = 437;
>     private static string deployment = "\\\\vm-osb-oasd\\sohaan";
>     static void Main(string[] args)
>     {
>         AllocConsole();
>         IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
>         SafeFileHandle safeFileHandle = new SafeFileHandle 
> (stdHandle, true);
>         FileStream fileStream = new FileStream(safeFileHandle,  
> FileAccess.Write);
>         Encoding encoding = System.Text.Encoding.GetEncoding 
> (MY_CODE_PAGE);
>         StreamWriter standardOutput = new StreamWriter(fileStream,  
> encoding);
>         standardOutput.AutoFlush = true;
>         Console.SetOut(standardOutput);
>         Console.Clear();
>         Console.WriteLine 
> ("= 
> ==================================================================");
>         Console.WriteLine("Welcome to the Compile and Deploy Oracle  
> Forms and Reports Facility");
>         Console.WriteLine 
> ("= 
> ==================================================================");
>         Console.Write("Please enter username: ");
>         string username = Console.ReadLine();
>         ....
>     }
> }
> This works perfectly in a C# environment. However, I do not know how  
> to embed it within a NAnt script correctly...From what I know about  
> NAnt, I may need to create an extension, but am uncertain of how to  
> go about this. Can anyone help me out?
>
> Meet local singles online. Browse profiles for FREE!
>
>
> Hotmail has tools for the New Busy. Search, chat and e-mail from  
> your inbox. Learn more.
> --- 
> --- 
> --- 
> ---------------------------------------------------------------------
> _______________________________________________
> NAnt-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------------

_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
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.