Skip to content

Improved HelloMsBuild sample with user input and greeting #7052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core/console-apps/HelloMsBuild/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
// Print welcome message
Console.WriteLine("Hello from MSBuild-powered .NET Console App!");

// Ask for the user's name
Console.Write("What's your name? ");
string name = Console.ReadLine();

// Greet the user
Console.WriteLine($"Nice to meet you, {name}!");

// Wait before closing
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}