I'm a novice in C# and Visual C# IDE, I don't know anything about how to use them at all. I have programmed all my life in C on EclipseIDE. I have searched on several places how to solve this problem but could not get a proper procedure to do so. I'm posting the question here, for that reason.
I downloaded a C# project, I wish to debug the project to see how an algorithm implementation works.
The project has come in a Folder, inside this folder there are -
.sln
file and- a folder which has - Source files and
.csproj
file.
I installed Visual Studio C# Express and opened the .sln file present in the main folder in the VS C# IDE. I built the project successfully, but when I try to debug the project I get this message:
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.
The strange part is that I don't see a main function anywhere.
What should I do to get ahead of this hiccup?
You'll need some kind of app (Console Apps are my favorite for debugging, but a WinForm will do) which uses your Class Library. Just add a new project (in the same solution) of a Console Application or Windows Forms Application, and add a reference to your current project. Once you've done that, make any calls you need, set your break points, and go to town.
Error solutions is that you have already open your project but by mistake you have selected another class library .. that's reason this error is showing ... so what u need to do you u just select u r project then right click on u r project
after right click u can see the list box and select the "Set as start up project " option .
Saikat Banik
If still not working after the above steps, then try this.
Then save (ctrl + S)
Try debugging (F5)
The project you have downloaded compiles into a dll assembly and provide a set of classes with implemented functionality.
You should add to your solution a new project with Output Type of either Console Application or Windows Application (VS Add Project wizard will offer you different templates of Projects).
In the newly added project, you can implement logic to test your Class Library.
Output type of the project you can find and change by the following steps:
Right click on project in Solution Explorer -> Properties.
In opened tab with properties select Application and there will be ComboBox marked with Output Type label.
Just needs to go:
Then try to debug it.
Surely your problem will be solved.
That is exactly your problem. The project merely creates a DLL. It has no executable to run.
You will need to add a second project, which is an executable which references the other project, and calls something in it.