![](/img/trans.png)
[英]Redirect input to .NET Core Console App on debugging in Visual Studio 2019
[英]Visual Studio 2019 not launching console app window when debugging
我這里有一個奇怪的,我似乎無法弄清楚。 上周才開始。 當我在 VS 2019 中調試控制台應用程序時,它不會啟動控制台 window。 我可以在 Main() 中設置一個斷點,它會中斷。 但沒有控制台。
我什至創建了一個全新的 Hello World 項目,但它不起作用。
即使這樣也行不通:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine ("Hello World");
Console.ReadLine();
}
}
}
正如 Jack J Jun 所說,在 VS 2019 中將目標設置為 x64 對我有幫助。 解決方案是在 VS 2017 中設計的,然后升級了工作室,是的,控制台應用程序停止顯示其控制台。
升級到 VS 2019 后,我也發生了同樣的事情。罪魁禍首是我的 csproj 文件中的這一行: <UseWindowsForms>true</UseWindowsForms>
。 不知道這條線是如何進入那里的......我沒有有意識地添加它。 升級添加了它,或者當我在不知不覺中單擊某些東西時添加了它,而以前版本的 VS 只是忽略了它。 無論如何,我從 csproj 文件中刪除了該行,控制台 window 又回來了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.