locked
Project with an output type of Class Library can't be started directly... RRS feed

  • Question

  • Hello!  I downloaded and tried running the SplashScreen here:

    http://www.codeproject.com/KB/cs/prettygoodsplashscreen.aspx

     

    I opened the project, tried to run SplashScreen.cs; now getting an error mssg: ‘A Project with an output type of Class Library cannot be started directly.  In order to debug this project, add an executable project to this solution which references the library project.  Set the executable project as the startup project.’

     

    I’m starting to learn C# now.  I’ve seen various C# error messages; never seen anything like this though!  What do I need to do to make this work?

     

    I’m using C# 2008 Express.

     

    Thanks!

    Ryan---

    Saturday, July 31, 2010 9:52 PM

Answers

  • Just right click the project TestIt on the right in your Solution Explorer and then click on 'Set As Startup Project'

    This will do the job - because the sample you downloaded contains two projects 1 is a library and the other is the executable. TestIt is the executable so you should put it as the startup Project.


    Ali Hamdar (alihamdar.com)
    • Proposed as answer by Morgan Herlocker Tuesday, August 3, 2010 6:40 PM
    • Marked as answer by Figo Fei Monday, August 9, 2010 2:42 AM
    Sunday, August 1, 2010 1:35 AM
    1. Download the sample,
    2. Open the solution file .sln,
    3. Follow the convertion wizard, the project get opened.
    4. Right click the project TestIt on the right in your Solution Explorer and then click on 'Set As Startup Project'.<optional>
    5. Press F6 to Build the solution, go to 6. or Press F5 to run the code in debug mode
    6. Open the TestIt.exe under location SplashScreen\TestIt\bin\Debug

    Thanks.


    Figo Fei


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Proposed as answer by Lentucky Sunday, August 8, 2010 3:27 AM
    • Marked as answer by Figo Fei Monday, August 9, 2010 2:42 AM
    Friday, August 6, 2010 2:24 AM

All replies

  • Just right click the project TestIt on the right in your Solution Explorer and then click on 'Set As Startup Project'

    This will do the job - because the sample you downloaded contains two projects 1 is a library and the other is the executable. TestIt is the executable so you should put it as the startup Project.


    Ali Hamdar (alihamdar.com)
    • Proposed as answer by Morgan Herlocker Tuesday, August 3, 2010 6:40 PM
    • Marked as answer by Figo Fei Monday, August 9, 2010 2:42 AM
    Sunday, August 1, 2010 1:35 AM
  • Hummm, I never realized you can even do that.  Ok, thanks for letting me know, Ali!  I follow your recommendation and got a faded window, then the code crashed and this line (in SplashScreen.cs) turned yellow:

    lblTimeRemaining.Text = "";

    Seems like a problem with the label, but I checked and it is there doesn't seem to be anything wrong with the label.  I actually deleted it, and added in a new label, with a new name, and changed all the references to that label.  What do you think could be wrong?

    Ryan--

    Sunday, August 1, 2010 2:29 AM
  • The error is 

    Cross-thread operation not valid

    This project is downloaded from Code Project - you can tell the one who did it that the error is happening and he should upload a working version.

    But the bug is clear - a quick fixation is to not set the text of the label in the funtion ReadIncrements() - but use a string variable defined in the form context and set its values accordingly.

    Then use a Timer Control to trigger every 1ms and just put it in lblTimeRemaining.Text = stringVariableDefinedEarlier;

    Here the label is being set from another thread and the error won't happen again.


    Ali Hamdar (alihamdar.com)
    Sunday, August 1, 2010 11:16 AM
  • Ok, thanks for the follow up.  Well, I looked at this for about 15 minutes or so, and I'm just drawing a total blank here.  I went here:

    http://www.developerfusion.com/tools/convert/csharp-to-vb/

    Converted the code to VB (which I'm a bit more comfortable with).  I didn't get it working in VB; still stuck!!  I think this would be a good c# learning exercise for me.  Can you please tell me, step by step, what to do to get this working.  I feel it is not difficult actually, but I must have gotten off track and now I'm a it lost.

    Thanks!

    Ryan---

    Sunday, August 1, 2010 2:55 PM
    1. Download the sample,
    2. Open the solution file .sln,
    3. Follow the convertion wizard, the project get opened.
    4. Right click the project TestIt on the right in your Solution Explorer and then click on 'Set As Startup Project'.<optional>
    5. Press F6 to Build the solution, go to 6. or Press F5 to run the code in debug mode
    6. Open the TestIt.exe under location SplashScreen\TestIt\bin\Debug

    Thanks.


    Figo Fei


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Proposed as answer by Lentucky Sunday, August 8, 2010 3:27 AM
    • Marked as answer by Figo Fei Monday, August 9, 2010 2:42 AM
    Friday, August 6, 2010 2:24 AM
  • Ok!  Got it working!  Thanks everyone!!!
    Sunday, August 8, 2010 3:02 AM