Results 1 to 6 of 6

Thread: [2005] compiling

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    [2005] compiling

    Hi!
    ppl i get this error while compiling.


    A project with an Output type of class library cannot be started directly
    In orfder to debug this project,add an executable to this solution which references the library project. set the executable project as the startup project



    this is my code
    Code:
    Imports System
    
    Public Structure Mohit
        Public age%, sex%
        Public Sub New(ByVal a%, ByVal sex%)
            age = a
            sex = sex
    
        End Sub
    End Structure
    Public Class Class1
        Public Shared Sub main()
            Dim amohit As New Mohit(22, 1)
            system.Console.WriteLine("the age is " & amohit.age)
            system.Console.Readline()
    
        End Sub
    End Class
    how i created the project??

    File--->New---->Project--->class library(this is one the listed templates).

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,439

    Re: [2005] compiling

    Your compiling the project by pressing the Start button, which attempts to run the project marked as the startup project after compiling. Your project is a library so it cannot be run directly. The compilation is completing properly so that's not an issue. Normally you would add a test application to your project that you can run as the startup project and use it to test your library while debugging. You can also use the project properties to specify an executable to run when you press Start instead, for the same purpose.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: [2005] compiling

    Add a new project to your solution.

    In that project, add a reference, and under the project tab, you should find the class library.

    Add it, then create an object of the type you have created, and start testing out its functions.

    Don't forget to... ^^ (What he said) set the new one as the startup project.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: [2005] compiling

    Quote Originally Posted by jmcilhinney
    Your compiling the project by pressing the Start button, which attempts to run the project marked as the startup project after compiling. Your project is a library so it cannot be run directly. The compilation is completing properly so that's not an issue. Normally you would add a test application to your project that you can run as the startup project and use it to test your library while debugging. You can also use the project properties to specify an executable to run when you press Start instead, for the same purpose.
    Hi!
    thanks for the reply.

    can you please tell me in steps what to do as i am new to vb.net 2005.

    thank you.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: [2005] compiling

    ill try what you have said mendhak

    thanks for the reply.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: [2005] compiling

    thnks people, both the things wrked for me .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width