繁体   English   中英

无法在 Visual Studio 2019 中添加新的 C# windows 表单

[英]Cannot add a new C# windows form in Visual Studio 2019

我想添加一个名为 Entry.cs 的新表单,但它以某种方式复制了带有锁定控件的 EntryForm.cs 的设计。

我不知道发生了什么,但以前我可以添加一个没有控件的新空白表单,但现在每当我创建一个新表单时,它只会复制带有锁定控件的 EntryForm.cs。

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

似乎缺少另一个选项,我只看到继承的选项,而且我打开了一个不同的项目,并且它的唯一继承选项是可用的。

当我尝试修复时,它显示以下错误: 在此处输入图像描述

错误日志:安装出现问题。

您可以通过以下方式对 package 故障进行故障排除:

1. Search for solutions using the search URL below for each package failure
2. Modify your selections for the affected workloads or components and then retry the installation
3. Remove the product from your machine and then install again

如果该问题已在开发者社区报告,您可以在那里找到解决方案或解决方法。 如果该问题尚未报告,我们鼓励您创建一个新问题,以便其他开发人员能够找到解决方案或变通方法。 您可以使用“提供反馈”按钮从右上角的 Visual Studio 安装程序中创建新问题。

==================================================== ===============================

Package 'Microsoft.AspNetCore.SharedFramework.5.0.5.0.1-servicing.20601.7.x64,version=16.8.30804.86,chip=x64' 无法修复。 Search URL https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.AspNetCore.SharedFramework.5.0.5.0.1-servicing.20601.7.x64;PackageAction=Repair;ReturnCode=1603 Details MSI: C:\ProgramData\Microsoft \VisualStudio\Packages\Microsoft.AspNetCore.SharedFramework.5.0.5.0.1-servicing.20601.7.x64,version=16.8.30804.86,chip=x64\aspnetcore-runtime-5.0.1-servicing.20601.7-win-x64.msi , 属性:REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 DOTNETHOME="C:\Program Files\dotnet" ALLOWMSIINSTALL="True" REINSTALL=ALL REINSTALLMODE="cmuse" IGNOREDEPENDENCIES=ALL 返回代码:1603 返回代码详细信息:安装过程中出现致命错误。 Log C:\Users\User\AppData\Local\Temp\dd_setup_20210109003135_063_Microsoft.AspNetCore.SharedFramework.5.0.5.0.1-servicing.20601.7.x64.log Impacted workloads ASP.NET and web development (Microsoft.VisualStudio.Workload.NetWeb,version= 16.8.30509.167) Impacted components .NET 5.0 Runtime (Microsoft.NetCore.Component.Runtime.5.0,version=16.8.30804.86) .NET Core development tools (Microsoft.NetCore.Component.DevelopmentTools,version=16.8.30607.99) .NET Core development tools ( Microsoft.NetCore.Component.Web,version=16.5.29721.120) .NET SDK (Microsoft.NetCore.Component.SDK,version=16.8.30804.86) ASP.NET and web development tools (Micros oft.VisualStudio.Component.Web,version=16.0.28517.75) Azure WebJobs Tools (Component.Microsoft.VisualStudio.Web.AzureFunctions,version=16.0.28714.129) Azure WebJobs Tools (Microsoft.VisualStudio.ComponentGroup.AzureFunctions,version=16.0. 28621.142) Cloud tools for web development (Microsoft.VisualStudio.ComponentGroup.Web.CloudTools,version=16.2.29003.222) Container development tools (Microsoft.VisualStudio.Component.DockerTools,version=16.4.29409.204)

我想创建一个新的空白表格,我该怎么做? 请帮忙谢谢!

那是因为您从创建对话框中选择了“继承形式”。 继承的表单继承自主表单,这就是您获得相同控件的原因。
尝试找到一个空表格,它应该在某个地方。 如果它不检查项目的设置。

所以我只是想通了我的公共部分 class EntryForm: Form 是导致问题的原因。 I change it to public partial class EntryForm: System.Windows.Forms.Form then I reinstalled C#.Net Framework seems like it was uninstalled after i installed ASP.Net, now I was able to choose Windows Form not inherited.

我有同样的问题,我发现如果你打开 Visual Studio 安装程序,select 修改。 你会看到.Net桌面开发没有勾选。 检查它 select 修改完成安装。 之后就可以再次 select 表格。

暂无
暂无

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

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