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

Viewed 3190

I want to add a new form named Entry.cs but somehow it copies the design of my EntryForm.cs with locked control.

I don't know what happened but previously i was able to add a new blank form without controls but now whenever I create a new form it just copies my EntryForm.cs with locked controls.

enter image description here enter image description here enter image description here

It seems like the other option is missing, I only see the inherited option also i opened a different project and its the same only inherited option is available.

When I tried repair it shows the error below: enter image description here

Error log: Something went wrong with the install.

You can troubleshoot the package failures by:

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

If the issue has already been reported on the Developer Community, you can find solutions or workarounds there. If the issue has not been reported, we encourage you to create a new issue so that other developers will be able to find solutions or workarounds. You can create a new issue from within the Visual Studio Installer in the upper-right hand corner using the "Provide feedback" button.

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

Package 'Microsoft.AspNetCore.SharedFramework.5.0.5.0.1-servicing.20601.7.x64,version=16.8.30804.86,chip=x64' failed to repair. 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, Properties: REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1 DOTNETHOME="C:\Program Files\dotnet" ALLOWMSIINSTALL="True" REINSTALL=ALL REINSTALLMODE="cmuse" IGNOREDEPENDENCIES=ALL Return code: 1603 Return code details: Fatal error during installation. 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 (Microsoft.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)

I want to create a new blank form, how can I do this? Please help thank you!

3 Answers

That's because you choose from creation dialog the "inherited form". Inherited form inherits from main form and that's why you're getting same controls.
Try to find an empty form, it should be somewhere there. If it doesn't check project's settings.

So i just figured it out my public partial class EntryForm : Form is causing the problem. 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.

I had this same issue, I found that if you open Visual Studio installer, select modify. You will see .Net desktop Development is unchecked. Check it select modify finish install. After you will be able to select Form again.

Related