简体   繁体   English

Visual Studio Community 2019 创建项目但无法打开它创建的项目?

[英]Visual Studio Community 2019 creates a project but cannot open the project it created?

I have Visual Studio Community 2019 v16.3.7.我有 Visual Studio Community 2019 v16.3.7。

According to dotnet --list-sdks I have the following SDKs installed根据dotnet --list-sdks我安装了以下 SDK

2.1.802 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Users\bugma\scoop\apps\dotnet-sdk\current\sdk]

I just created a .NET Core DLL project.我刚刚创建了一个 .NET Core DLL 项目。 It created the following sln and csproj files:它创建了以下slncsproj文件:

Solution:解决方案:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
MinimumVisualStudioVersion = 10.0.40219.1
Global
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {26BC7AEA-9E58-472D-8800-8D620A97AED6}
    EndGlobalSection
EndGlobal

CSProj: CSProj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

</Project>

a Class1.cs file is also in the folder. Class1.cs 文件也在文件夹中。

If I shutdown Visual Studio and launch Visual Studio from the.sln file, the Solution Explorer tells me that 0 projects have been loaded.如果我关闭 Visual Studio 并从 .sln 文件启动 Visual Studio,解决方案资源管理器会告诉我已加载 0 个项目。

If I shutdown Visual Studio again and launch from the.csproj file, I get a dialog box that says, "One or more errors occurred."如果我再次关闭 Visual Studio 并从 .csproj 文件启动,我会看到一个对话框,上面写着“发生了一个或多个错误”。 I click on the "OK" button and select "View > Output" and "View > Error List" but both panels are empty.我单击“确定”按钮和 select“查看 > 输出”和“查看 > 错误列表”,但两个面板都是空的。 So where do I find information about the error?那么我在哪里可以找到有关错误的信息?

This is all a bit weird and frustrating.这有点奇怪和令人沮丧。 You'd expect that a project that Visual Studio creates is then able to be opened in Visual Studio and worked on.您希望 Visual Studio 创建的项目随后能够在 Visual Studio 中打开并进行处理。

LATER之后

I have stripped out the scoop -installed dotnet SDK.我已经删除了scoop安装的 dotnet SDK。 Now dotnet --list-sdks says现在dotnet --list-sdks

1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]

This has not improved anything though.但这并没有改善任何东西。

I think you have missed the OutputType in Project file, So that, it's not working properly.我认为您错过了 Project 文件中的 OutputType,因此它无法正常工作。 Please add the property <OutputType>Exe</OutputType> .请添加属性<OutputType>Exe</OutputType> Let me know, whether it's worked for you or not让我知道它是否对您有用

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
    <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

</Project>

If you transferred the project file some important files must have been lost.This is the only reason for your trouble.如果您传输了项目文件,一些重要文件肯定丢失了。这是您遇到麻烦的唯一原因。

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

相关问题 Visual Studio 2019不会在项目打开时提取所需的Docker映像 - Visual Studio 2019 does not pull required Docker images at project open 如何使用 python 代码在 Visual Studio 2019 中打开我的项目 - How to open my project in visual studio 2019 using python code Visual Studio 无法打开或创建项目 - Visual Studio cannot open or make project 无法在Visual Studio 2017中打开项目 - Cannot open the project in Visual Studio 2017 无法在 Visual Studio 2019 中调试 .netstandard2.0 项目 - Cannot debug netstandard2.0 project in Visual Studio 2019 在 Visual Studio 2019 社区中将 Azure API 链接到 C# ASP.Net 项目的问题 - Issue linking Azure API to C# ASP.Net project in Visual Studio 2019 Community 如何在 Visual Studio 2019 社区版中将我的发布项目转换为安装程序? - How do I turn my release project into an installer in Visual Studio 2019 Community Edition? 无法在 Visual Studio 2019 社区版 16.7.2 中使用外部应用程序调试 c# dll 项目 - Unable to debug c# dll project with an external app in Visual Studio 2019 Community edition 16.7.2 Visual Studio Community 2015添加了对项目的引用 - Visual Studio Community 2015 adding a reference to project 我的Windows窗体在Visual Studio社区设计器中被“缩小”。 最初在VS Express 2010中创建的项目 - My Windows Form is “shrunk” in Visual Studio Community Designer. Project originally created in VS Express 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM