简体   繁体   English

Visual Studio 2019 未创建 OBJ 或 BIN 文件夹

[英]Visual Studio 2019 not creating OBJ or BIN folder

So basically I'm trying to create a simple console application.所以基本上我正在尝试创建一个简单的控制台应用程序。 However, whenever I create one instead of seeing the usual run button I am instead greeted to a button that says attach so I read through forum after forum and I found out that I need an OBJ and a Bin folder.但是,每当我创建一个而不是看到通常的运行按钮时,我都会看到一个显示附加的按钮,所以我一个接一个地阅读论坛,发现我需要一个 OBJ 和一个 Bin 文件夹。 So I looked through my solution and found that I have no bin or obj folder created.所以我查看了我的解决方案,发现我没有创建 bin 或 obj 文件夹。 So I tried to make a new solution however in this new solution again there is no bin or obj folder.所以我尝试制作一个新的解决方案,但是在这个新的解决方案中又没有 bin 或 obj 文件夹。 I honestly don't know what to do anymore.老实说,我不知道该怎么办了。 Here are some images:这里有一些图片:

在此处输入图像描述 在此处输入图像描述

Make sure you are actually creating a solution in Visual Studio.确保您实际上是在 Visual Studio 中创建解决方案。 The straightforward way to do that is to use File / New / Project... in the menu.最直接的方法是使用菜单中的文件/新建/项目...。 Then you will likely have a dialog box, and there you need to find Console Application - C# .然后你可能会有一个对话框,你需要在那里找到Console Application - C# Then type your project and solution name - it's ok if they're the same name.然后输入您的项目和解决方案名称 - 如果它们同名就可以了。 Then save.然后保存。 That's all.就这样。

Do not use the menu to open Program.cs or other files in your solution, once your solution is created.创建解决方案后,请勿使用菜单打开解决方案中的 Program.cs 或其他文件。 Use the Solution Explorer, and click on the file you want to see.使用解决方案资源管理器,然后单击要查看的文件。 If you don't see the Solution Explorer, use View / Solution Explorer in the menu.如果您没有看到解决方案资源管理器,请使用菜单中的查看/解决方案资源管理器

Later, when you want to reopen your solution, use File / Open / Project/Solution... in the menu, and open your solution file, whose name ends with .sln Or even easier, look in File / Recent Projects and Solutions .稍后,当您想重新打开您的解决方案时,请使用菜单中的File / Open / Project/Solution... ,然后打开您的解决方案文件,其名称以.sln结尾,或者更简单,查看File / Recent Projects and Solutions

You will likely want to add more source files to your projects very soon, so I'll tell you how to do that too.您可能希望很快将更多源文件添加到您的项目中,因此我也会告诉您如何做到这一点。 In the Solution Explorer, right click on the project (not the solution), and in the popup menu, point at Add and then New Item... to get a dialog, then choose Class - C# .在解决方案资源管理器中,右键单击项目(不是解决方案),然后在弹出菜单中,指向添加,然后指向新建项...以获取对话框,然后选择类 - C# Type the name of the file while keeping the extension .cs , and then Add it.在保留扩展名.cs同时键入文件名,然后添加它。

The process should look something like this:该过程应如下所示:

在此处输入图片说明

It's probably likely that there is an issue with dotnet on your path variable.您的路径变量上的 dotnet 可能存在问题。 Go to your system variables and add C:\\Program Files\\dotnet\\ to path.转到您的系统变量并将C:\\Program Files\\dotnet\\到路径。 It should fix the issue if you had the same problem as me.如果你和我有同样的问题,它应该可以解决这个问题。

You may have been building a console app that can run on .NET Core and you just don't have the NuGet packages installed.您可能一直在构建可以在 .NET Core 上运行的控制台应用程序,只是没有安装 NuGet 包。 Then you need to either install the appropriate packages or create a console application (.Net Framework)然后你需要安装适当的包或创建一个控制台应用程序(.Net Framework)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM