[英]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:它创建了以下
sln
和csproj
文件:
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.