Where is the "project file"? - c#

I have created a .NET7 C# project, and I'm trying to understand this article: https://learn.microsoft.com/hu-hu/dotnet/desktop/winforms/whats-new/net60?view=netdesktop-6.0#new-application-bootstrap about the new bootstrap that moves the configurations to the "project file":
To complement the new application bootstrap feature of Windows Forms, a few Application
settings previously set in the startup code of the application should be set in the project
file. The project file can configure the following application settings:
The only thing it doesn't mention is where can we find the project file? Is it editable from Visual Studio directly? Or we have to create it for ourselves?

In visual studio explorer, double click on the file with "csproj" extension (it has a rectangular icon with C# written in green. This will open the file in xml format. In most cases, you don't need to manipulate it manually.

Related

Trying to obtain the exe for a c# form Application, getting .dll file

i've already searched and seen almost all in the web and in the forum, but i can't deal with that.
What I'm trying to do is to obtain an installer and then an exe of my form application by using c# in visual studio 2019.
So, i've followed that tutorial:
https://www.youtube.com/watch?v=fehVTLNQorQ&ab_channel=FoxLearn
so i correctly obtain the setup file. Then, when i launch it, it installs and if i try to run it i get that error: "You're trying to open a file type system .dll"
What i'm doing wrong?
I also structured my main class as in that response:
Changing a source file to compile Main() method in a project, in VS c# console application
I also used that suggested setting (sorry for non english language but it's quite understandable):
Is there somebody that can help me? thanks a lot
Some things you may want to check:
If you have more than one project in your solution, make sure that the main project is marked as Start-up project. On the solution explorer, right- click on the main project and select "Set as start-up project".
If you only have one project in your solution, check that no .exe is being produced in the corresponding bin folder. If it is, go to your project properties, inside Debug, and make sure that the option "Start project" is selected. You can also try to select the option "Start external program" and browse to the .exe in your bin folder (although the result should be the same).
If no .exe is produced, you may want to have a look at this post. It is similar to you problem I think but the other way round. I looks that the UseAppHost should be True for your case
You have to choose "Publish Items" and not "Primary Output" when you add a "Project Output" in "Application Folder" for .Net Core 3.1 in the setup project created by Visual Studio Installer Projects Extension.
# Alessio Orlando.
Based on my test, there is a different step between adding different project to the installer.
For WPF App(.NET Framework) project and Windows Forms App(.NET Framework) project: You could choose Primary output when you add a "Project output" in "Application Folder" in the setup project.
For WPF Application(.NET Core) project and Windows Forms App: As gigiabbrescia said, you have to choose Publish Items when you add a "Project Output" in "Application Folder" in the setup project.
Finally, there will be an .exe file in your installation directory after installing your Setup (Like the picture below). And you could click on your .exe file to run the program.

WPF C# Properties.Settings doesn't exist [duplicate]

This question already has answers here:
Equivalent to UserSettings / ApplicationSettings in WPF .NET 5, .NET 6 or .Net Core
(8 answers)
Closed 2 years ago.
I'm trying to create simple application/user settings for my WPF application.
Most answers and tutorials suggest using Properties.Settings.Default for this.
However, Settings doesn't exist in my Properties namespace.
There is also no .settings file in my project explorer, as the microsoft documentation suggests:
Open Visual Studio.
In Solution Explorer, expand the Properties node of your project.
Double-click the .settings file in which you want to add a new setting. The default name for this file is Settings.settings.
Also there is no Settings tab in my project properties window, as some (older?) resources suggest.
Check out this answer: https://stackoverflow.com/a/58423458/10703868
Looks like you are using .NET Core instead of .NET Framework with WPF. Right click on your MyApp Project and add a new folder titled "Properties". Then right click on that and add a new item. Search for settings, add the settings file. They you should be able to use this.
I don't see the settings tab in my project properties view, but if you right click on the settings file you can change the Open with to be the settings designer for the old view.
WPF App (.NET Core) template doesn't seem to be adding .settings file by default, as opposed to WPF App (.NET Framework).
You can add it by right clicking your project file -> Add -> New Item... -> Settings File (you can search for it, or browse for it under Visual C# -> General).

How to add a Setup project through Visual Studio DTE?

I am trying to develop a template Visual Studio 2008 solution making use of the IWizard interface. So far I have been able to successfully add multiple projects to the solution. I am now looking to put in a Web Setup project into the solution which will already have the Project Output from a particular project specified.
I read that a .vdproj file cannot be part of a template, so looking at any other alternate options available.
One option that I tried but did not work was to save the contents of the .vdproj file within the wizard and write it out after the solution gets generated. I am wondering if I can use the Visual Studio ExecuteCommand to add a Project and add the Output Group in the setup project without displaying the UI.
Anyone tried this before?
I found the answer.
The method of saving the contents of the .vdproj file within the wizard works. However, before writing out the content to a file and adding it as a project, the GUID of the project which would be used in the Setup project (Project Output or Content Files) has to be replaced in the saved text.
Visual Studio adds a unique project GUID once the project gets added to the solution, and this GUID has to be read using the Visual Studio SDK and replaced in the actual .vdproj file text.

C# Visual Studio 2010 embed exe icon

I have made an anplication with Visual Studio C# 2010 Express, and I have set my icon in the project properties -> application -> ressources ...
like this
but when I try to launch my app, I need to copy my icon in the same folder of the application
How can I embed it ?
What you've done is to add a pointer to a file on disk; instead, it's probably simpler to link the icon directly into your executable as a resource.
This page shows how to add an Icon resource to your .NET application: http://msdn.microsoft.com/en-us/library/7k989cfy(v=vs.80).aspx
Once you've done this, you can point to the application icon that is compiled into your program, and it won't have to live on disk in a separate file.

How do I embed a banner image and or add remove programs icon in my setup project?

I'm using a setup project in visual studio 2010 to create an installer for a program I'm working on. I want to have a custom banner image in my setup as well as a custom icon in add remove programs.
I've added both these images to the "Application Folder" of my installer and was able to get them to show up correctly. However, my program is not very big and only installs as an EXE and a few DLLs. So it seems a little silly to me that the 4th and 5th files that get "installed" are graphics only used during installation.
Is there some way I can embed these images in the installer or one of my other projects?
I'm currently using VS 2008 and just been playing around with the setup project. I believe the following works - it did in my tests.
Select the setup project in the solution explorer window.
Right click and select Add/File
Find your banner Image file and add it.
You will see that it's been added to the Application folder.
Select the banner file in the application folder - or in the project list on the solution explorer.
Open the Properties Window
On the properties set "EXCLUDE" to TRUE.
When you set exclude to true you will see the banner file removed from application folder - but it will still be shown in the project tree - the icon will for the file will have a little red circle with a line through it.
I've done this with both the banner and a custom icon and tested my install - worked fine with both and neither file showed up in the application folder.
Hope this helps.
In the setup project properties you can put an image for the add/remove icon in the property AddRemoveProgramsIcon
For the banner image, right click on the setup project, View -> User Interface, click on the page you want, and then in the properties you want the BannerBitmap property.
This blog discusses a way to change the banner image without modifying the Visual Studio project.
If you want to change of the icon of the application EXE, then you just need to right click on the EXE and "create shortcut". In the properties you will find the icon and you can change it.

Categories