C# Visual Studio 2010 embed exe icon - c#

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.

Related

Visual Studio Setup Project User Desktop Shortcut icon doesn't work... why?

I developed a VS Setup Project with many Projects Output. I added 3 desktop shortcuts to my project outputs and I attached the .exe icon to the shortcut. After run the setup, I can see only one icon and the other 2 icons are the application default icon as showed in my desktop shortcut.
The only one difference to the icons are the size: the first one correctly showed is 128x128, the other 2 are 512x512 but if I open the Debug folder in the App Project the icon look very well.
Does VS Setup project have a limitation for icons??
I created a demo using Visual Studio Installer Project.
I used two icons, one 128x128 and one 669x512. Both can be displayed correctly.
One of the icons I used had an error during the test and couldn't run. (The reason for my error is that there is an error in the icon file, so it cannot be displayed correctly. It is recommended that you check your icon file)

Where is the "project file"?

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.

Setup wpf .net proyect works but exe didn´t find

I´m tring to instal an app that I create with wpf (.NET 4.8), I used Microssoft Visual Studio Installer Projects and these are the steps that I follow:
I add a new proyect to the solution.
In Aplication Folder/Add/Project Output...
Primary output and Localized resorces.
Finally i Build the solution
I loock for the exe in the folder instalation but only there is a .ddl and a .josn.
Thanks.
In sted of Primary outPut, I have used PublishItemsOutputGroup.
# michu. According to your description, there may be a problem with your steps. Please check if the following steps are same with you .
1.Download and install Microsoft Visual Studio Installer Projects.
【Click Extensions in Visual Studio to search for Microssoft Visual Studio Installer Projects to download and install】
2.Create a Setup Project named Setup.
3.Add WPF software primary output DLL file into installer.
【Right-click Setup and select Add/**Project Output...**and modify the "Add Project Output Group" page as follows:】
4.Add installer setup icon file.
【Right-click Setup and select Add/File... and add the APP.ico file as application icon: (I did not add an application icon here.)】
5.Create WPF software shortcut for Desktop.
【Right-click on the generated file and rename it to apptest and drag it to User's Desktop. Then right-click apptest in User's Desktop and select Properties Window…:】
6.Configure the details of WPF software properties.
7.Build Setup Installer.
【Click Build and select Batch Build and modify as follows:】
8.Install.
After the installation is complete, you can see the exe in the installation path.

Embedding Images in WPF User Control?

I have created a WPF control which I have embedded in a windows application. I have created an ImageBrush and set its source from the code behind as
imgBrush.ImageSource = new BitmapImage(new Uri(#"Images/imagename.jpg", UriKind.Relative));
This works fine when I am running the project from visual studio but when I install the setup and then run the application I get path not found error.
You can add the images folder to your installer project through visual studio, see here:
http://msdn.microsoft.com/en-gb/library/vstudio/4ddxk2ye(v=vs.100).aspx
Or to embed the image in the executable, just set the build action of the image to "Embedded resource" (in the properties dialogue in visual studio solution explorer)
Found the solution. Apparently when you embed the WPF control in a Winform application then you have to add the resource to the Winform application. I added the same image as a resource in the winform application and it worked.

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