Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2004, 09:57 AM
Authorized User
 
Join Date: Feb 2004
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried to compile my class after placing it in the C:\nant\bin folder.My class file contains the following code.
Public Class Book
    Private _title as String
    Private _isbn as String
    Private _author as String
    Private _result as String
    Private _profit as Double
    Private _price as Decimal
    Private _LocalPrice as Decimal
    Private _LocalCur as String
        Private _LocalCurSym as String

    Public Sub New(NewTitle,NewIsbn,NewAuthor)
        _title = NewTitle
        _isbn = NewIsbn
        _author = NewAuthor
    End Sub
    Public Property Title() as String
        Get
          return _title
        End Get
        Set(value as String)
          _title = value
        End Set
    End Property
    Public Property ISBN() as String
        Get
          return _isbn
        End Get
        Set(value as String)
          _isbn = value
        End Set
    End Property
    Public Property Author() as String
        Get
          return _author
        End Get
        Set(value as String)
          _author=value
        End Set
    End Property
    Public ReadOnly Property LocCurSym() as String
        Get
           return _LocalCurSym
        End Get
    End Property
    Public ReadOnly Property Profit() as Double
        Get
           return _profit
        End Get
    End Property
    Public ReadOnly Property Result() as String
        Get
          return _result
        End Get
    End Property
    Public ReadOnly Property LocalPrice() as Decimal
         Get
          return _LocalPrice
        End Get
    End Property
    Public Sub ConLocal(LocCur as String)
        _LocalCurSym = LocCur
        Select Case LocCur
            Case "US Dollar"
                 _LocalPrice = _price
                 _LocalCurSym = "$ "
            Case "Rupees"
                 _LocalPrice = _price * 60.00
                 _LocalCurSym = "Rs."
            Case "Canadian Dollar"
                 _LocalPrice = _price * 43.50
                 _LocalCurSym = "$ "
        End Select
    End Sub
    Public Sub CalcProfit(CostPrice as Double,RetailPrice as Double)
        If (CostPrice <= 500 And RetailPrice <= 500) Then
            _price = RetailPrice
            _profit = RetailPrice - CostPrice
            Select Case _profit
                Case 0
                      _result = "No Profit No Loss"
                Case > 0
                      _result = "Profit"
                Case < 0
                       _result = "Loss"
            End Select
        Else
             Exit Sub
        End If
    End Sub
End Class
I named it as Book.Class and then executed the nant -buildfile:Book.class.
This is what i got:
NAnt version 0.8.3 Copyright (C) 2001-2003 Gerry Shaw
http://nant.sourceforge.net

C:\nant\bin\Book.Class(1,1):
 Error loading buildfile
        There is invalid data at the root level. Line 1, position 1.

For more information regarding the cause of the build failure, enable log4net us
ing the instructions in NAnt.exe.config and run the build again.

Try 'nant -help' for more information

Could you tell me how to sort out this problem, again thanx for your precious support.

&nbsp;&nbsp;CEO InteliSoft

Maqsood ur Rahman
 
Old March 23rd, 2004, 10:58 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Did you create a build file?
Also, I'd recommend naming the code file book.vb so it doesn't get confused with a java .class file.

I took your class code from the post, created a .vb file out of it, and created a build file. Here's the build file. Maybe this will help get you started...


<?xml version="1.0" encoding="utf-8" ?>
<project name="Book" default="build">
    <description>Build the book class.</description>

    <property name="dir.buildOutput" value="bin" />
    <property name="debug" value="false" />
    <property name="assembly.name" value="Maxood.Book" />
    <property name="assembly.ext" value="dll" />

    <target name="clean" description="remove all generated files">
        <delete failonerror="false">
            <fileset>
                <includes name="${dir.buildOutput}\*" />
            </fileset>
        </delete>
    </target>

    <target name="init" depends="clean" description="Preps for compilation">
        <mkdir dir="${dir.buildOutput}" />
    </target>

    <target name="build" depends="init" description="compiles the source code">
        <vbc target="library" output="${dir.buildOutput}\${assembly.name}.${asse mbly.ext}" rootnamespace="${assembly.name}"
            optionexplicit="true" optionstrict="false" debug="${debug}">
            <references>
                <includes frompath="true" name="System.dll" />
                <includes name="*.dll" />
            </references>
            <sources>
                <includes name="*.vb" />
            </sources>
        </vbc>
    </target>
</project>

I was able to build your code without a problem. The end result of this is that you should have a \bin directory with the file Maxood.Book.dll in it.

I'd recommend NOT running nant from within the nant\bin directory so you don't mess up anything that's there. Add the path of the nant bin directory to your system PATH variable so you don't need to reference it with a complete file path.

Put the build file (something like "book.build") in an empty directory with "book.vb" and then run nant. Nant will find the .build file and use the tasks to build accordingly.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old March 25th, 2004, 03:31 PM
Authorized User
 
Join Date: Feb 2004
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would like to ask you if someone would like to earn a creer in developing and designing classes,controls,DLLs Active X,COM components etc. then how should be his approach.What exacly he should go for initially.How he shold practice.Plus i have heard that C++ is the best suited langauge for this sort of work, is it true, if yes then why?
Thankyou so much for your enormous support, i will reply you soon about the outcome of my class.

   CEO
InteliSoft

Maqsood ur Rahman
Life:An Endless Journey towards Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
My own class in asp.net 2.0 DarkForce ASP.NET 2.0 Professional 1 October 13th, 2008 12:39 PM
Error When Using Webclient class in ASP.NET sebastiansony .NET Web Services 0 June 24th, 2005 12:16 AM
Class existens in ASP.NET mega ASP.NET 1.x and 2.0 Application Design 7 November 23rd, 2004 01:30 PM
.NET class file in ASP page shahpragnesh_p VS.NET 2002/2003 1 August 22nd, 2003 10:50 AM
Exception Handling in ASP.net class mittalpa VS.NET 2002/2003 0 July 11th, 2003 03:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.