我想运行和调试 .Net Core (2.2) 控制台应用程序(不是 ASP.Net Core!)。因此,我创建了一个非常简单的应用程序:
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);
}
}
添加了 Docker 文件。
添加了Microsoft.VisualStudio.Azure.Containers.Tools.TargetsNuGet 包。
最后修改为launchSettings.json:
{
"profiles": {
"dotnetapp": {
"commandName": "Project"
},
"Docker": {
"commandName": "Docker"
}
}
}
因此,一切看起来都像在带有 Docker 支持的默认 ASP.Net Core WebApp 中。
但在“运行”时,我只收到错误“无法使用此应用程序执行配置文件‘Docker’”。
我不明白,有什么区别?如何像 .Net Core ASP 应用程序一样运行简单的 .Net Core 应用程序?
暮色呼如
相关分类