Reputation: 1144
I want to run and debug a .Net Core (2.2) Console application (not ASP.Net Core!). Therefore, I've created a very simple app:
public static class Program
{
public static void Main(string[] args)
{
WriteLine("**Environment**");
WriteLine($"Platform: .NET Core");
WriteLine($"OS: {RuntimeInformation.OSDescription}");
WriteLine();
ReadLine();
}
private static (string, bool) ParseArgs(string[] args)
{
var buffer = new StringBuilder();
var withColor = false;
foreach (var s in args)
{
if (s == "--with-color")
{
withColor = true;
continue;
}
buffer.Append(" ");
buffer.Append(s);
}
return (buffer.ToString(), withColor);
}
}
Added a Docker file.
Added the Microsoft.VisualStudio.Azure.Containers.Tools.Targets
NuGet package.
Finaly changed the launchSettings.json
to:
{
"profiles": {
"dotnetapp": {
"commandName": "Project"
},
"Docker": {
"commandName": "Docker"
}
}
}
So everything looks like in a default ASP.Net Core WebApp with docker support.
But on "run" I only get a error "The profile 'Docker' can not be executed with this application".
I don't get it, what's the difference? How can I run a simple .Net Core App the same way like a .Net Core ASP App?
Upvotes: 4
Views: 324
Reputation: 2569
Seems like a non-answer, but it seems to work for Steffen (and myself) in Visual Studio 2019. Maybe there is a bug in the Visual Studio 2017 tooling...
Upvotes: 1