Reputation: 221
I am new to .Net Programming, I am writing and executing c# console programs in Visual Studio 2010, Can you help me how to execute multiple programs in a single project , i tried the option as" exclude from project" but the .cs file is vanished from the project . Can u please help me how to execute multiple programs in the single project . because each time i have to create new project for executing a simple program.
Upvotes: 2
Views: 4346
Reputation: 475
In the solution explorer, you can right-click on a project. In the context menu select Debug\Start new instance.
You can do this for multiple projects before running your main project.
Upvotes: 0
Reputation: 18593
One console project generates one .exe file. You cannot have multiple console C# programs in single project, if by "program" you mean .exe file.
If by "program" you mean the abstract concept of computer code, you must specify more clearly what exactly you're trying to achieve.
edit: After seeing your comment and definition of "program", I suggest the following: Create two classes (right click on the project -Add> Class), then create code in Program.cs that executes either Class1 or Class2 like this
static void Main(string[] args) {
Class1.Execute(args);
// Or:
Class2.Execute(args);
}
..given that Class1
and Class2
both define a method with the signature static void Execute(string[] args)
Upvotes: 3