Change the icon of the exe file generated from Visual Studio 2010 - visual-studio-2010

I am currently creating an application in Visual Studio 2010. After building the project to generate the output of my application, I find that the .exe is built with the default icon.
Is there any way to change or use my own picture as the icon for the .exe file generated by Visual Studio 2010?

To specify an application icon
In Solution Explorer, choose a project node (not the Solution node).
On the menu bar, choose Project, Properties.
When the Project Designer appears, choose the Application tab.
In the Icon list, choose an icon (.ico) file.
To specify an application icon and add it to your project
In Solution Explorer, choose a project node (not the Solution node).
On the menu bar, choose Project, Properties.
When the Project Designer appears, choose the Application tab.
Near the Icon list, choose the button, and then browse
to the location of the icon file that you want.
The icon file is added to your project as a content file.
reference : for details see here

I found it easier to edit the project file directly e.g. YourApp.csproj.
You can do this by modifying ApplicationIcon property element:
<ApplicationIcon>..\Path\To\Application.ico</ApplicationIcon>
Also, if you create an MSI installer for your application e.g. using WiX, you can use the same icon again for display in Add/Remove Programs. See tip 5 here.

Check the project properties. It's configurable there if you are using another .net windows application for example

Related

How to add a PDF file to a visual studio project?

Is it possible to add a PDF file to a visual studio project? If it is, how?
You must first add the PDF to the file system, inside your project directory. After the PDF document exists inside the project directory, go to Visual Studio and click the Show All Files button which is found in the top right of the solution explorer window. If the file is not visible, you may need to click the Refresh button. Then right click the PDF and choose Include in Project.

How to make visual studio project into exe file and give UI

I have a code which detects the FACES from the image file (C++ file). I am using Visual Studio-2010 and OpenCV-2.4.10 for this project.
Now I want to create an EXE file and I want to give User Interface which will ask the user to upload an image and produces the Output image back on to the User Interface.
So how can I do this.
Please help me in this regards.
Thankz in advance.
To build a solution that's open in Visual Studio and selected in Solution Explorer, you can:
On the menu bar, choose Build, Build Solution.
Or, in Solution Explorer, open the shortcut menu for the solution and then choose Build Solution.
Or, press F7. (This is the default keyboard shortcut for the C/C++ development settings.)
Or, in the Command Window (on the menu bar, choose View, Other Windows, Command Window), enter Build.BuildSolution.
Or, in the Quick Launch box, enter build build solution.
To build a project that's selected in Solution Explorer, you can:
On the menu bar, choose Build, Build .
Or, in Solution Explorer, open the shortcut menu for the project and then choose Build.
Or, in the Command Window (on the menu bar, choose View, Other Windows, Command Window), enter Build.BuildOnlyProject.
Or, in the Quick Launch box, enter build project only build only .
You can then navigate to the build location, either /debug or /release depending on the option you have chosen, you will find your .exe there
You need to use Publish from right-clicked project in Solution Explorer

Will VS 2010 display recent used project and solution in the context menu of the start menu?

Start menu in Windows 7 has a feature: a programs, pinned to the top, can show a context menu with recently used files:
alt text http://img65.imageshack.us/img65/5149/contextmenustartmenuwin.png
Will Visual Studio 2010 be able to display also recently used Projects and Solutions?
It is possible to pin solution files to the recently used file list.
First make sure you already have Visual Studio pinned to the Start Menu.
Next, drag the Solution file on to the Start Menu so that it is pinned in the main list.
Now select the the Recently Used Files button for Visual Studio so that the list is showing.
Drag the solution file from the main list into the recently used file list.
You can now remove the solution file from the main list.
Beta 1 doesn't seem to support this yet. Its easily possible by using the new Taskbar APIs and specifically the custom categories feature. I think their main problem might be that the solution files are associated with an app called VSLauncher.exe (this small app determines what version of VS to load when you launch a SLN file).
If you want to "pin" your fav solution files to any version of VS, one option this is (I currently used this with VS 2008 and 2010 Beta 1:
Open Explorer and browse to any SLN file you want to pin.
Drag it and pin on the taskbar (it will pin to VSLauncher.exe; this is okay)
Now just repeat the steps for other SLN files.
When you click on a SLN file from the above pinned program's jumplist, another instance of VS2010/VS2008 will launch. It won't show your recent projects or solutions, but atleast it allows you to pin your fav/recent solutions manually. I think you can use this for CSProj or other project files as well.

how can I find the location of the solution/project on my harddrive in Visual Studio?

I want to know where the solution/project is stored on my hard drive.
I would have thought right clicking on the project from within Visual Studio would have the information on where it is stored on my hard drive, but it doesn't.
Click on the project itself in the solution explorer and in the properties window it lists the project folder.
Only works if you've actually saved the project though. I.e. newly created projects don't have a location.
Start up Visual Studio and go to Tools->Options.
In the dialog box that opens, make sure to check the box that displays "Show All Settings."
From there, you should find a setting called "Projects and Solutions" which will have the list of default locations for projects, templates, etc.
When you have loaded you project in Visual Studio select the solution in the Solution explorer window and then select Properties window. You will see "Path" in the Properties window which points to the actual file.
Open one of the files in your Solution and hover over the tab in the code window. The full path will show up in a tooltip.
You can also go to Window | Windows... which shows you full path to all open files.
One way is to select the project in the solution explorer and then click File / Save As or press F4 and view the 'Project Folder' property.

How do I "Add Existing Item" an entire directory structure in Visual Studio?

I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure.
I want to add them in that format to a different directory in an ASP.NET web application I am working on; while retaining the same structure. So, I copied the folder into the target location of my project and I tried to “add existing item” only to lose the previous folder hierarchy.
Usually I have re-created the directories by hand, copied across on a one-to-one basis, and then added existing items. There are simply too many directories/items in this case.
So how do you add existing directories and files in Visual Studio 2008?
Drag the files / folders from Windows Explorer into the Solution Explorer. It will add them all. Note this doesn't work if Visual Studio is in Administrator Mode, because Windows Explorer is a User Mode process.
Enable "Show All Files" for the specific project (you might need to hit "Refresh" to see them)**.
The folders/files that are not part of your project appear slightly "lighter" in the project tree.
Right click the folders/files you want to add and click "Include In Project". It will recursively add folders/files to the project.
** These buttons are located on the mini Solution Explorer toolbar.
** Make sure you are NOT in debug mode.
In Solution Explorer:
Click Show All Files (second icon from the left at the top of Solution Explorer).
Locate the folder you want to add.
Right-click and select "Include in Project"
I use this to install add-ons like HTML editors and third-party file browsers.
I just want to point out that two of the solutions offered previously,
Drag and drop from Windows Explorer
Show All Files and then include in project.
do not do what the question asked for:
Include in project while preserving the directory structure.
At least not in my case (C++/CLI project Visual Studio 2013 on Windows 7).
In Visual Studio, once you are back in the normal view (not Show All Files), the files you added are all listed at the top level of the project.
Yes, on disk they still reside where they were, but in Solution Explorer they are loose.
I did not find a way around it except recreating the directory structure in Solution Explorer and then doing Add Existing Items at the right location.
I didn't immediately understand this based upon these descriptions but here is what I finally stumbled on:
Turn on "Show All Files" - there is an icon on the Solution Explorer toolbar
Using Windows Explorer (not solution explorer), move your files into the directory structure where you want them to reside
Click "Refresh" also on the Solution Explorer toolbar
The files that you've moved should be visible "ghosted" in the Solution Explorer tree structure where you've placed them
Right click on your ghosted files or folders and click "Include in Project". All the contents of a folder will be included
Below is the icon for the 'Show All Files', just for easy reference.
Click above in the red circle. Your folder will appear in Solution Explorer.
Right click on your folder -> Include in project.
You can change your project XML to add existing subfolders and structures automatically into your project like "node_modules" from NPM:
This is for older MSBuild / Visual Studio versions
<ItemGroup>
<Item Include="$([System.IO.Directory]::GetFiles("$(MSBuildProjectDirectory)\node_modules","*",SearchOption.AllDirectories))"></Item>
</ItemGroup>
For the current MSBuild / Visual Studio versions:
Just put it in the nodes of the xml:
<Project>
</Project>
In this case just change $(MSBuildProjectDirectory)\node_modules to your folder name.
You need to put your directory structure in your project directory. And then click "Show All Files" icon in the top of Solution Explorer toolbox. After that, the added directory will be shown up. You will then need to select this directory, right click, and choose "Include in Project."
This is what I do:
Right click on solution -> Add -> Existing Website...
Choose the folder where your website is. Just the root folder of the site.
Then everything will be added on your solution from folders to files, and files inside those folders.
At last, Visual Studio 2017 allows the user to import an entire directory with a single click. Visual Studio 2017 has a new functionality "Open Folder" that allows opening the entire folder, even without the need to save it as solution. The source code can be imported using the following methods.
Menu File → Open → *Folder (Ctrl + Shift + O)
devenv.exe <source folder>
It even supports building and debugging CMake projects.
Bring your C++ codebase to Visual Studio with “Open Folder”
There is now an open-source extension in the Marketplace that seems to do what the OP was asking for:
Folder To Solution Folder
If it doesn't do exactly what you want, the code is available, so you can modify it to suit your scenario.
HTH
A neat trick I discovered is that if you go to "Add existing...", you can drag the folder from the open dialog to your solution.
I have my Visual Studio to open in Admin Mode automatically, so this was a good workaround for me as I didn't want to have to undo that just to get this to work.
What worked for me was to drag the folder into Visual Studio, then right click the folder and select "Open Folder in File Explorer". Then select all and drag them into the folder in Visual Studio.
In Windows 7 you could do the following:
Right click on your project and select "Add->Existing Item". In the dialog which appears, browse to the root of the directory you want to add. In the upper right corner you have a search box. Type *.cs or *.cpp, whatever the type of files you want to add. After the search finishes, select all files, click Add and wait for a while...
The cleanest way that I've found to do this is to create a new Class Library project in the target folder, and redirect all of its build output elsewhere. It still leaves a .csproj file sitting in that folder, but it does let you see it in Visual Studio and pick which files to include in your project.
It has been a while since this was originally posted, but here is an alternative answer.
If you only care to be able to look at the physical files from inside visual studio and do not necessarily require to see them in the solution explorer default view, then click on the switch view button and choose the folder view and any physical directory/directories that are under your solution root folder will appear here even if they do not appear in the solution explorer default view.
If however, you want to add a folder tree that isn't too large as a virtual solution directory/directories to match your existing tree structure, do that and and then "add the existing" physical files to the virtual directory/directories. If the physical directory exists in your solution directory it will not copy the files - it will link directly to the physical files but they will appear as part of the solution virtual directories.
It's annoying that Visual Studio doesn't support this natively, but CMake could generate the Visual Studio project as a work around.
Other than that, just use Qt Creator. It can then export a Visual Studio project.

Resources