How to add new win form in project C#? - c#

I have existing project. I tried to add new empty form in this, but I have limited choose of windows form that mean to inheriting. But I need just simple form.
I use VS 2017

It seems like you didn't install the required components. To do this, close VS, run your Visual Studio Installer (you probably installed VS through it), click modify for your VS Version and make sure that .Net desktop development is checked:
Then launch the installation by hitting Modify and start VS again. If you now want to create a new Project it should look something like that:

Try this
Open Solution Explorer
Right click on your Project's Name.
Add.
Windows Form.
If you still don't see it, you might be missing the Dot Net desktop development Component.

Related

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

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.
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:
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!
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.

Cannot find Console App(.NET Framework) in Visual Studio 2017

https://imgur.com/a/WMUfMtG
I want to start learning C#, I wanted to use Visual Studio and the tutorial I am following from requires me to open up ConsoleApp(.NET Framework) within the New Project section. However, I cannot even see this option or any of the other options for that matter. I'm not sure if my Program is bugged or if I'm just missing something within the installation. When I first started to download it however, an error came up exclaiming that I had I was missing redistributable package c++ or something like that on an unsecure internet connection. I have no idea what any of that meant so I just hit cancel. this also comes up whenever I try to play PUBG.
In the screenshot you provided, just hit ok and you will have created a new C# Console App project.

How to View the Windows form application In Windows Service Application running as service

I have a Windows Service Application which contains one Service.cs and one Windows Form Application.Now as per my requirement i have to make a setup installer of this application which i did using Visual Studio Setup project under Deployment Section.
Now if i will install my setup Windows Service file will be added as Service and we can see it and its working fine also but i am not seeing the windows form application.
In the control panel add/remove program my application has been added as i am seeing it but windows form application is not showing in All programs of start button.
Please help me .
Thanks in advance.
If this is urgent:
In the File System Editor for the setup project, it should show the target machine's file system. By default, the primary outputs you've specified will be set to install to the "Application Folder". But what you want to do is to look under the "User's Programs Menu" (I can't remember if this shows up by default - if not, right click "File System on Target Machine", "Add Special Folder" and select this folder).
Then, in the right-hand pane, right click and choose "Create New Shortcut", navigate down through "Application Folder", select the windows forms application and hit OK. Then give it a suitable name.
If this isn't urgent - go and find a better setup tool and learn how to do similar things to the above using that tool. Visual Studio 2010 was the last version to include the Setup project support, so spending time learning this tool now is wasted time. Better to find a tool that will continue to work as you upgrade VS versions. I'd normally suggest WiX since it comes at a great price (free) but it does have a learning curve (since you author the setup in XML).

Question on deploying winform project

I want to seperate one project from my main winform project, then "publish" it or something so that i will be able to click a button and the application will run, instead of running visual C# expresss and then run the project.
How do I achieve that?
It's not really clear what you mean, but just building your Windows Forms application will create a .exe file - you can copy that (along with any DLLs it requires) to another machine which has the appropriate .NET framework on, and then just double-click on the executable to launch it. (You can copy it to elsewhere on the same machine as well, of course.)
You certainly can create "setup" projects to bundle everything into an installer, but for simple needs copying a file would be fine. You don't need to launch it through Visual Studio.
When you compile your application as Windows app, it is executable out of VS environment. Just change the properites of the project.
And what do you mean click a button? From desktop, you need to double/single click the application from its directory to launch it.
Again qs is not clear.

Creating Windows Installer Project in Visual Studio

I've been struggling with Visual Studio to create a windows installer msi.
This is what I was hoping to create in the msi:
Installer opens and first page has a couple fields where you can enter various config locations, including being able to browse, and also some drop downs with various config setups.
Click Next or Finish or whatever and custom C# code I have written gets executed depending on the choices chosen by the user.
When looking at the Visual Studio Installer Project, I can add a dialog, but they are all predefined for me. I was hoping for something like when you create a Windows Forms Application.
Is this not possible? Is the windows installer project just that inflexible? What are my other options in Visual Studio (note I don't want to use another program that may be out there)?
The Installer class gives you a way to take get full control of what happens during installation for a VS installation project. However, you would have to use a modal dialog to collect the information you're describing, so the user experiecne would not be as smooth as an integrated wizard page.
I strongly suggest you to take a look into WIX.
It is more complex than VS install projects but it is much more flexible also

Categories

Resources