I think you might want to cut the CCNet part out of that solution. CCNet gives you a nice interface to start the build, but it sounds like you want it to prompt the DBA for credentials which you are unlikely to achieve. I would recommend having the DBA simply run NAnt from a command line, then your script will work (as you've tested). If you need to run it on a different machine than the one the DBA is using, PSExec in PSTools will do the trick.
Hope that helps. --- Chris. Continuous improvement is better than delayed perfection. - Mark Twain On Tue, Apr 20, 2010 at 8:53 PM, Simon H <yo...@live.com> wrote: > I am designing a automated compilation script for an Oracle Forms and > Reports development environment containing numerous databases with > associated projects. As the username and password for connecting to the > databases differs, and because of organisational measures in place that > require that developers are not privy to the username and password for > various databases (only DBA's have these rights). The ideal solution is: > > > - The DBA runs a force build from CCNet via their browser using the > WebDashboard. > - CCNet calls a NAnt script that prompts them for the > username, password and database relevant to the files they wish to have > automatically compiled and deployed (I am already able to achieve this in a > NAnt build file using C# scripting as outlined in previous post) > > > However, for some reason CCNet does not execute the NAnt build file as > desired (outlined in previous post). How can I make CCNet execute the NAnt > build file so that it correctly runs the embedded C# script that prompts for > user input? > > ------------------------------ > From: xtopher.bra...@gmail.com > Date: Tue, 20 Apr 2010 20:38:19 -0700 > > Subject: Re: [NAnt-users] C# sharp scripting and NAnt + CCNet > To: yo...@live.com > CC: nant-users@lists.sourceforge.net > > > Hi Simon, > > CCNet is generally used for automated/unattended builds. What is the core > problem you are trying to solve with this solution, ie, why do you want user > input during a CCNet build? > --- > Chris. > > Continuous improvement is better than delayed perfection. - Mark Twain > > > On Tue, Apr 20, 2010 at 8:17 PM, Simon H <yo...@live.com> wrote: > > > "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?" This is not a > viable solution due to security considerations. > > > ------------------------------ > Date: Tue, 20 Apr 2010 20:03:58 -0700 > From: rongrabow...@yahoo.com > > To: nant-users@lists.sourceforge.net > 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 <yo...@live.com> > *To:* nant-users@lists.sourceforge.net > *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!<http://clk.atdmt.com/NMN/go/150855801/direct/01/> > > ------------------------------ > Australia's #1 job site If It Exists, You'll Find it on > SEEK<http://clk.atdmt.com/NMN/go/157639755/direct/01/> > > > ------------------------------------------------------------------------------ > > _______________________________________________ > NAnt-users mailing list > NAnt-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nant-users > > > > ------------------------------ > Looking for a hot date? View photos of singles in your > area!<http://clk.atdmt.com/NMN/go/150855801/direct/01/> >
------------------------------------------------------------------------------
_______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users