NAntContrib "slingshot" vs. NAnt "solution"

I was trying to build the latest NAntContrib project so I could take advantage of their Slingshot task which automagically converts a visual studio solution (*.sln) and projects (*.csproj - not sure about *.vbproj) into a handy-dandy NAnt *.build file complete with all reference, source inclusions, dependencies, debug, release, and clean targets. Nice.

The only problem with this approach of course is that you need to run it daily if you don't want your NAnt builds to break when a new project or reference is added to your solution. Fortunately, NAntContrib exposes slingshot not only as a command line tool but also as a native NAnt task. The pain is that NAntContrib doesn't have a “stable release” but only a “nightly build”.....which of course is not built against the NAnt “stable release”. So I had to throw away my NAnt stable release that I've been using and opt for the latest nightly build for it too. After I got both to compile successfully I started to battle goofy slingshot issues like having to map web projects to my local hd path, avoiding spaces in my paths, and ReallyReallyReallyLongPaths.  I ended up doing a subst to map a directory to a drive letter to make it short. All this to create a build file that will get thrown away each and every night.

While browsing through the new things added to NAnt since the stable release I was accustomed too, I discovered a new task “Solution”. It compiles a whole solution - sln file. No generation of a build file. My build file literally goes from hundreds if not thousands of lines to this.

<target name="Debug">

<solution solutionfile="ObjectSharp.Framework.sln" configuration="Debug" />

target>

This compiles our entire framework, with all 8 projects as referenced in the sln file, in the right order, with the same dependencies used by a developer while using the VS.NET IDE. What a concept: share the build files used by your build server and IDE so that there are no surprises or impedance mismatches. Such a great idea that MS is doing this with MSBuild in Whidbey. I wonder if MSBuild will have add on tasks like NAntContrib, like for Visual Source Safe, sending email, running NUnit, and executing SQL. I like my NAnt - not sure if I'll be able to break free with MSBuild.

Comments

  • Barry Gervin November 15, 2003 10:31 AM

    DaveLloyd tells me he's having trouble getting compiles that actually work on a VB project with this. Clean compile - but the DLL's just work. I know he has some crazy large solutions out there. As an aside though, his client has written a SlingShotish thing for VB solutions/projects.

  • TrackBack May 7, 2004 11:35 AM

  • Barry Gervin May 30, 2004 11:48 PM

    cannot build web project "http://......csproj"
    please use <webmap> to map the given URL to a project-relative path or specify enablewebdav="true" on the <solution> task element to use webdav

  • Barry Gervin May 31, 2004 9:26 AM

    For web projects you have to create a <webmap> section to tell it where the localhost points to.

    Check out the sample here: http://nant.sourceforge.net/help/tasks/solution.html

  • Barry Gervin June 17, 2004 3:53 PM

    I am not sure if <solution ..> works with vcproj files included in sln? I tried a simple one but I got an error message:

    Project with GUID '' must be included for the build to work.

    in my vcproj file, ProjectGUID attribute is not there. I am not sure how to add this attribute and how it works for the building process.

  • Barry Gervin July 19, 2004 10:50 AM

    We experince problems with WebMap, I believe nant not use the webmap and try direct to use WebDav than I receive The remote server returned an error: (403) Forbidden.
    Anyone knows how to solve that?

  • Barry Gervin October 4, 2004 4:54 PM

    It doesn't appear that <solution> allows for conditional compilation constants.

  • Barry Gervin October 13, 2004 7:23 AM

    I was also having problems compiling an ASP.Net solution with nant with the solution tag but I manage to resolve this.

    I did not had to use the webmap tag nor the enablewebdav attribute. I just had to give the following permissions in IIS: "script source access" in the web site directory so NAnt can get the source files and "write" access in the bin directory so nant can upload the dll.

  • Barry Gervin November 10, 2004 10:43 AM

    I am using NAnt and the solution tag. I have included a Webmap attribute with url and path as well. However, I keep getting this error:

    BUILD FAILED
    Error checking whether 'http:/localhost/xxx.proj' is an enterprise template project. The remote server returned an error: <500> Internal Server Error

    Any clues what is wrong? Thanks

  • TrackBack November 12, 2004 7:40 AM

  • Barry Gervin December 9, 2004 4:42 AM

    Hey Stephen,

    Have you tried checking the "script source access" option in the properties of the virtual directory in the IIS screen?

    I had faced a similar problem (though instead of the Internal server error i had the forbidden access error or something cant remember exactly ),i checked the above mentioned option and it worked

    My problem was caused coz NANT accesses the virtual directory which is protected by IIS security policies (Correct me if i am wrong)
    Hence checking on that option solved my problem.

    let me know if this works!

    Thanks

    Shaunak

  • Barry Gervin December 9, 2004 9:26 AM

    Well, if you're using the <solution /> task, you don't really need NAnt. Just create a batch file and invoke devenv.exe.

  • Barry Gervin December 9, 2004 12:58 PM

    Ooh that's ugly. You still need NAnt to invoke your tests, compile your documentation, increment your build #, label your source control, etc. etc. There is much more to a typical NAnt script than doing a compile.

    I also believe that the NAnt Solution task does not invoke devenv directly so Visual Studio is not a requirement for the build server (which should be as clean as possible).

  • Barry Gervin December 17, 2004 3:34 PM

    I am trying to build the solution which has WEb propject and i don't want to use WebMap element instead just want to use enablewebdav="true" only.

    I have given the permission of "script source access"

    But i get the following error....

    -- URI formats are not supported

    Any pointer on this issue. please let me know.

    Regards
    Vineet Batta

  • TrackBack January 5, 2005 4:01 AM

  • Barry Gervin January 7, 2005 11:29 AM

    How about going the other way, [i.e., transforming NAnt *.build to VS.NET 2003 *.sln]? I'm trying to create a *.sln file from a hierarchy of existing NAnt build files. My thinking is that an XML transformation tool could do the trick, but before I try to write one from scratch - has anyone already solved this problem?

    Your Thoughts.

    Regards,
    Craig

  • Barry Gervin January 7, 2005 11:32 AM

    I'm thinking convert your Nant builds to MSBuilds in whidbey - which are the solution/project file formats in whidbey. I think you'll have a tough go of it in 2003 since the proj/sln files are not exactly open.

  • Barry Gervin January 13, 2005 1:30 PM

    Trying to build a web project and I get the following:

    INTERNAL ERROR

    System.Net.WebException: The underlying connection was closed: Unable to connect
    to the remote server.
    at ystem.Net.HttpWebRequest.CheckFinalStatus()
    at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
    at System.Net.HttpWebRequest.GetResponse()
    at NAnt.VSNet.WebDavClient.DownloadFile(String localFileName, String remoteFileName)
    at NAnt.VSNet.Project.Load(Solution sln, String projectPath)
    at NAnt.VSNet.ProjectFactory.LoadProject(Solution sln, SolutionTask slnTask,
    TempFileCollection tfc, String outputDir, String path)
    at NAnt.VSNet.Solution.LoadProjects()
    at NAnt.VSNet.Solution..ctor(String solutionFileName, ArrayList additionalProjects, ArrayList referenceProjects, TempFileCollection tfc, SolutionTask solutionTask, WebMapCollection webMappings, FileSet excludesProjects, String outputDir)
    at NAnt.VSNet.Tasks.SolutionTask.ExecuteTask()
    at NAnt.Core.Task.Execute()
    at NAnt.Core.Target.Execute()
    at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
    at NAnt.Core.Project.Execute()
    at NAnt.Core.Project.Run()

    Anyone seen anything like this? Any ideas?

    Thanks
    Jeff

  • Barry Gervin January 14, 2005 3:52 PM

    I can't get the solution task to compile a 3rd party license like ipWorksSSL. However, slingshot w/nmake works just fine.

  • Barry Gervin February 17, 2005 2:40 AM

    Hi Guys,

    I have a query iam trying to get source code from a remote system and build a solution.My question is that is there a tag in nant or nantcontrib that will enable me to login into the server using the userid and password and get then get into the VSS.

    if i try the regular way i get the error Failed to open database "\\---------\srcsafe.ini" Com objet with CLSID(_______) is either not valid or not registered

    can u help me solve this problem

  • Barry Gervin March 14, 2005 6:18 AM

    Like Stephen, I also get this error:

    Error checking whether 'http:/localhost/xxx.proj' is an enterprise template project. The remote server returned an error: <500> Internal Server Error

    I have checked the 'Script Source Access'
    I am working on A Windows2003 Server

  • Barry Gervin June 30, 2005 4:12 PM

    I did compile multile VB projects in a SLN successfully using the <solution> in NAnt

  • Barry Gervin July 11, 2005 11:42 AM

    If you have problems of the FORM ...
    Error checking whether 'http:/localhost/xxx.proj' is an enterprise template project. The remote server returned an error: <500> Internal Server Error

    ... the best thing to do is check the http logs and see which requested file caused the 500 error. In my case it was files that should not have even been in the project. I excluded them and the project compiled.

  • Barry Gervin August 27, 2005 5:29 PM

    Just started working with NAnt and noticed that it can compile a list of projects from a projects list text file. So my solution was to build the list dynamically before the compiles (created a project that got called before the build), that way I always had an up to date projects list. NAnt autonmatically handles dependencies and ordering, just like it does when using a solution file.

    Gary

  • Barry Gervin October 24, 2005 11:56 AM

    I am trying to build the solution with Web propject and i tried both WebMap element and enablewebdav="true".

    I have given the permission of "script source access"

    But i get the following error....

    -- URI formats are not supported

    Any help is greatly appreciated..

  • Barry Gervin November 7, 2005 2:19 PM

    I am using the solution task form the Nant 8.4 and am experiencing an issue with references and I wondering if this is a known bug in v8.4. If I clean my working folder prior to executing a build, get latest then execute the solution task it fails to find the reference made in one of the projects as the path to the referenced file, within the sln file, is different to the output directory that my solution task is writing to. Does this mean that I am dependant on VS? If I open the sln in VS and compile, since the reference files are in each of the project's bin\debug folder I don't have the issue. In addition, if I run my solution task, since I have just created the assemblies and they are stored with the correct reference path, I also don't receive the error. The error only happens when I run the solution task on a clean directory. Am I missing something?

  • Barry Gervin November 8, 2005 10:24 AM

    I was able to resolve this, by taking a different approach with the Solution task. instead of using the solutionfile attribute I excluded it and used the project sub task. I included all the projects in the order of dependencies and voila. Its always reassuring to know that persistance does pay off.

  • Barry Gervin November 23, 2005 10:15 AM

    I beat my head against the wasl for about 2 hours with this one:

    <map url="http://localhost/PurchasingResults" path="${code.dir}/wwwroot" />

    Looks fine, right? And it is, except that the solution file had this little gem...

    Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xyz", "http://localhost:/PurchasingResults/xyz.csproj", "{67EB1802-7CF1-4FC8-9E5C-53188FB74A23}"

    See the difference? Neither did I. It's the colon in the SLN reference. Perfectly fine part of a URL, except that you'll hardly ever actually use one. And no, I don't know how it got in there. But apparently, if those strings don't match exactly, NAnt doesn't get it.

    Took the colon out and it works fine.

  • Barry Gervin December 9, 2005 12:20 AM

    Hi
    I have one solution file (src.sln) which contains 3 project files,which contains no of .cs files,I used to slingshot for converting purpose now how to run NAnt tool,actually i downloaded NAnt 0.85-rc3 bin.zip version in that no Nantrunner is there so separately i installed one problem is there ,that is in my system VS-2005 beta 2 version Nantrunner installed only in 1.1.4322 version this warning is came in NantRunner downloading..so i want to which version is better for NAnt running?any example of above problem(src.sln) conversion using NAnt build tool
    please urgent,,Thanks & Regards
    Sridevi

  • Barry Gervin January 12, 2006 6:13 PM

    I finally solved the issue related to the Nant <Solution> task where it stated a guid was not found it must be included. Or something like that. Visual studio is smart enough to recognize that the project belongs to the solution even though the .sln file has one guid for the (i.e. a.csproj) and another guid for within the a.csproj file. However, Nant requires that the guid is exactly the same. I compared all the csproj files and all had the same one except for the a.csproj itself. I modified it, reran my scripts finally resolved the issue after trying many suggested fixes. Persistance is victorious once again.

  • Barry Gervin February 6, 2006 8:51 PM

    I've found a fix for the errors like this:

    Error checking whether 'http:/localhost/xxx.proj' is an enterprise template project. The remote server returned an error: <500> Internal Server Error

    Be sure to reference the csproj file in both the url and path attributes of the map attribute (under webmap). Like this:

    <?xml version="1.0"?>
    <project name="Master">
    <solution solutionfile="MasterWeb.sln" configuration="debug">
    <webmap>
    <map url="http://localhost/XPWeb/XPWeb.csproj" path="Z:\pc\XPSystems.Web\XPWeb\XPWeb.csproj" />
    </webmap>
    </solution>
    </project>

  • Barry Gervin March 13, 2006 7:41 AM

    I went through all the replies for this mail title. But I still cud not get the solution to my problem. I am getting error message like
    'project with GUID must be included for this project to build'. Cud anybody help me for this ? I m using <referenceprojects> tag of the solution task to include references to the project being build. Actually NAnt build file requires to include the dependecies at all levels. i.e. if I include a project in solution task and its correspoding reference,NAnt still requires to include those references of the included reference of that project. Please if anybody knows solution, reply immediately. Thank You

  • Barry Gervin March 23, 2006 5:12 AM

    I am getting the following error
    "Project with GUID '{23BE96CA-1130-4A9C-B445-DB69E7D01389}' must be included for
    the build to work."

    while executing the following code

    <?xml version="1.0" encoding="utf-8" ?>
    <project name="ORTS" basedir="." default="build" >



    <target name="build" description="Build the solution">

    <!--************* This example shows how to compile to whole solution ******************-->

    <solution configuration="Debug" outputdir="bin">
    <projects>
    <include name="Entity/Entity.vbproj"/>
    <include name="Constants/Constants.vbproj"/>
    <include name="Controller/Controller.vbproj"/>
    <include name="Database/Database.vbproj"/>
    <include name="Domain/Domain.vbproj"/>
    <include name="Entity/Entity.vbproj"/>
    <include name="Facade/Facade.vbproj"/>
    </projects>


    <webmap>
    <map url="http://localhost/ORTSWeb/ORTS.vbproj" path="ORTS.vbproj" />
    </webmap>

    </solution>
    </target>
    </project>


    Can anyone help me out please.

  • Barry Gervin May 2, 2006 12:14 AM

    Hi Deepak, I had the same error when running the solution task.

    In my case it was because the project depended upon another project that I was not referencing. I found the guid that nant was talking about in the vbproj file. Then included that file as a referenceproject.

    Not sure if it is the same error, but thought I would mention it anyway.

  • Barry Gervin June 29, 2006 8:27 AM

    Hi
    I have web project and it has two projects in the solution .
    one is .csproj and other one is .vbproj.
    now when i m running my NANT script it gives me an error as
    [solution] Assembly "d:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll", referenced by project "CVTProton", does not exist.

    but the problem is this APToolkitNET.dll available in
    c:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll.
    So i am liitle confuse about this error.
    my nant scrip for the solution is
    <solution solutionfile="CVTProton.sln" configuration="Release" >

    <webmap>
    <map url="${Proton.VirtualPath}" path="${Proton.ProjectPath}\CVTProton.vbproj" />

    <references>
    <include name="C:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll" />
    </references>
    </webmap>

    <projects>
    <include name="${Proton.ProjectPath}\BIREPORTSDLL\BIReportsDll.csproj" />
    </projects>

    </solution>

  • Barry Gervin June 29, 2006 8:28 AM

    Hi
    I have web project and it has two projects in the solution .
    one is .csproj and other one is .vbproj.
    now when i m running my NANT script it gives me an error as
    [solution] Assembly "d:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll", referenced by project "CVTProton", does not exist.

    but the problem is this APToolkitNET.dll available in
    c:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll.
    So i am liitle confuse about this error.
    my nant scrip for the solution is
    <solution solutionfile="CVTProton.sln" configuration="Release" >

    <webmap>
    <map url="${Proton.VirtualPath}" path="${Proton.ProjectPath}\CVTProton.vbproj" />

    <references>
    <include name="C:\Program Files\activePDF\APToolkit\dotNetComponents\APToolkitNET.dll" />
    </references>
    </webmap>

    <projects>
    <include name="${Proton.ProjectPath}\BIREPORTSDLL\BIReportsDll.csproj" />
    </projects>

    </solution>

    and also i want to make a refrence of C# Project in my Vb Porject is it correct what i wrote ..?
    Please any body can help ..?
    Thanks - Amish

  • Barry Gervin September 6, 2006 5:53 AM

    hallo,

    I try to create a nant build file but after the input:

    c:\SLiNgshoT -nant MyProjSolution.sln

    I get the following exception, could anybody help me

    Unhandled Exception: System.ApplicationException: this is not a 'Microsoft Visual Studio Solution File' file
    at SLiNgshoT.Core.Solution.Read(String path, Hashtable uriMap)
    at SLiNgshoT.Core.Driver.WriteSolution(SolutionWriter writer, TextWriter textWriter, String sln, Hashtable parameters, Hashtabl
    e uriMap)
    at SLiNgshoT_Console.Main(String[] args)

  • Gaker January 23, 2007 8:40 AM

    Slingshot is not a tool but sack with bugs.

    DLL's are often corrupted + problems with embedding resources + required XML comments generation + other ugly issues.

New Comments to this post are disabled