HowTo: Building MediaPortal with NAnt (1 Viewer)

Mr.Mitchell

Retired Team Member
  • Premium Supporter
  • May 13, 2004
    227
    0
    the Netherlands
    NAnt is a commandline make utility. The main advantage above C# Builder or #Develop is that it uses the Visual Studio .NET files that are in CVS, so no importing/conversion is neccesary. The obvious disadvantage is that it is not an IDE.

    My current setup is using ConTEXT as the editor, with a shortcutkey that starts NAnt and a compile-output-parsing-rule so I can jump to errors that occured during the compile. Next to that I use the DbgCLR debugger that comes with the .NET SDK for setting breakpoints, stepping etc...

    Lets get started on the HowTo.

    First download NAnt (http://nant.sourceforge.net/). Do NOT download 0.84 since the solution task does not work correctly in that build. Use a nightly build instead. I am currently using "nant-0.85-20040520.zip" which works just fine. After downloading extract it somewhere, after that it is ready to use. No extra installation is neccesary.

    Now we have to make a build file for NAnt to use. The file looks like this, the current CVS of Media Portal has a mediaportal.build file that is similar to the one below.
    Code:
    <?xml version="1.0" ?>
    <project name="MediaPortal" default="debug">
    
      <target name="debug">
        <solution configuration="debug" solutionfile="MediaPortal.sln">
          <assemblyfolders>
            
            <includes name="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" />
            
            <includes name="E:\Team MediaPortal\MediaPortal" />
          </assemblyfolders>
        </solution>
      </target>
    
    </project>
    The paths between the <assemblyfolders> tags are ONLY needed if Nant is not able to find some assemblies. I had this problem in the past, but after installing the new .NET and DirectX SDKs everything was fine. If you do not need them you can remove the <assemblyfolders> tags and everything between it.

    Now you can open a command window and go the the place where you created the MediaPortal.build file. Now just run Nant and it will detect the build file and start compiling everyting.

    After it finished compiling you should copy all files and folders (EXCEPT for PostBuild.bat !!!) from the "mediaportal\xbmc\bin\Release" folder to the "mediaportal\xbmc\bin\Debug" folder. You have to do this only once.

    Now you can start your newly built copy of MediaPortal.exe from "mediaportal\xbmc\bin\Debug"

    The next time you want to compile just start NAnt again and it will only recompile the changed stuff. After this you can start the MediaPortal.exe again to check your new stuff.

    NOTE: Currently there is only a debug target.

    Questions, suggestions. Post them here.
     
    L

    Lost

    Guest
    I keep on getting this error message when I attempt to run Nant: "application has generated an exception that could not be handled." Can someone please tell me what the problem is.

    Mr.Mitchell said:
    Now we have to make a build file for NAnt to use.

    Also, what do you mean by "make a build file". There was already a build file from the cvs. Can I use that one? or must I make(create) a knew one?

    Thank you for any input.
     

    Mr.Mitchell

    Retired Team Member
  • Premium Supporter
  • May 13, 2004
    227
    0
    the Netherlands
    From the PM you sent me it sounds like you are having a problem with your .NET framework installation. Make sure you installed 1.1 framework version and NOT the 2.0 Beta framework. You can get this from the Microsoft site or through Windows Update.

    The buildfile in CVS should be useable. It wasn't there at the time I wrote the first version of the How-to. Note that the paths in the build file are not really needed when the .NET SDK and DirectX SDK's are installed properly. This is also noted in the how-to but easy to oversee.

    Nowadays I use the buildfile you can find at http://www.xs4all.nl/~wetering/mp/mediaportal.build

    Hmm, guess I should update the howto. Anyway, I hope you can get it working.
     
    A

    Anonymous

    Guest
    Building works great except for one warning:
    Couldn't find referenced assembly 'E:\cvs_sources\mediaportal\IControl.dll'.
    I tried to find that file with Google but I can't find it anywhere. :(
     

    Mr.Mitchell

    Retired Team Member
  • Premium Supporter
  • May 13, 2004
    227
    0
    the Netherlands
    The IControl reference is not needed anymore and the IControl.dll file has been removed from CVS. The reference is still in ProcessPlugins.csproj. I asked Frodo to remove the reference, but he does not have the reference. For some weird reason this reference is still visible in anonymous CVS. For now just manually remove this reference.

    - Open ProcessPlugins.csproj with a texteditor
    - Remove the following lines

    Code:
                    <Reference
                        Name = "IControl"
                        AssemblyName = "IControl"
                        HintPath = "..\IControl.dll"
                    />

    - Save
    - Build
     
    A

    Anonymous

    Guest
    Mr.Mitchell said:
    The obvious disadvantage is that it is not an IDE.

    I have programmed something so I know a bit of C++, java and visual basic but what are the main disadvantages when mediaportal isn't compiled to be an IDE. :?:
     

    Mr.Mitchell

    Retired Team Member
  • Premium Supporter
  • May 13, 2004
    227
    0
    the Netherlands
    IDE means Integrated Development Environment. Visual Studio, #Develop and C# Builder are IDE's. You have one application that you can use to do everyting. So it has a nice editor, most of the times with codeinsight features and syntax highlighting, you can compile the project by a press of the button and you can debug it from the same program.

    With Nant you can only compile. So you need an additonal editor and a debugger. And since you are working with 3 different programs it is less comfortable than doing everything from one program.

    Hope this clears things up
     
    A

    Anonymous

    Guest
    Yes that clears alot. I knew what the shortening was but I didn't know that it means a program of capable debugging, editing and compiling. I just thought it was a somekind of else compiling style :oops:
     

    Users who are viewing this thread

    Top Bottom