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

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

Related

Is there a way to set a keyboard shortcut to open containing folder of a selected file in Solution Explorer in Visual Studio?

When I click on a C++ project in Visual Studio, I get this menu:
And so I can quickly press Alt+F,F(Command ProjectandSolutionContextMenus.Project.OpenFolderinFileExplorer) to open the folder of the project.
I also found that I can open containing folder if I open the file in the Text Editor in Visual Studio:
I bound it to Alt+F,F as well. I set it to only be active in Text Editor, it's the File.OpenContainingFolder command.
But when I click on files inside the project in the Solution Explorer, there is no context menu:
I tried to make the File.OpenContainingFolder command global, but it still doesn't work in the Solution Explorer when I just click on a file once. If I double click it and open it in the text editor, it works.
And I can't find a command in the Keyboard section in options of Visual Studio to open containing folder of a file selected in the Solution Explorer.
Maybe someone knows how to do it?
You can create an external tool menu item, and then bind a shortcut to that item.
Go to Tools > External Tools.
Click Add.
In Title edit box type Show in Explorer.
In Command edit box type explorer.exe.
In Arguments edit box type /select, $(ItemPath). There is a space between a comma and a dollar sign.
Click OK.
Make note at the position of the new command in the list. It could be first, it could be fifth, or something else. Let's assume it's the fifth one.
Assign a shortcut to the command Tools.ExternalCommand5. Restrict the shortcut to Solution Explorer.
That's it.

Is there a Visual Studio option or add-on to add an "Open Explorer Here" when I right click on a project in the solution folder?

When I right click on a project in the solution explorer I'd like to be able to select an option that would open a new windows "Explorer" that lists the contents of the build directory. I'd settle for the project directory... but getting me into /bin/x86/Debug vs /bin/x86/Release based on the active build configuration would be major bonus.
I find myself manually navigating to that folder fairly often for various reasons - usually on Utility applications which don't have installers / cmd line build scripts etc
I currently use 2005 express. But, am open to upgrading.
A couple things that might be close enough:
add an "external tool" to the Tools menu. In the "Tools | External Tools..." dialog:
Click "Add" and give the new tool whatever name you want
Command: %systemroot%\system32\cmd.exe
Argument: /k "c:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86
Initial directory: $(TargetDir) // (or whatever appropriate macro)
Right click on a open document's tab and select "Open containing folder"
My VS 2005 Standard IDE already had a "Visual Studio 2005 Command Prompt" tool, but it landed the command window in the VC installation directory. Changing the "Argument" and "Initial directory" fields as above made it land in the project's target directory.
The drawbacks are they don't show up in the right menu for the project and they might not land you exactly where you want, but they should land you pretty close.
No sure this is what you want but the "Open file" icon will pop up a FileOpen dialog in the project folder. From there you can right click the Release or Debug folders to open them in an Explorer (and Cancel the dialog).

Change the icon of the exe file generated from 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

How can I find out the value of $(ProjectDir)?

Where can I execute and find out the value of $(ProjectDir)?
To find out what it is right now (rather than at build time, where it may be different depending on what is going on):
right click on your project in the Solution Explorer, select Properties
select the Build Events tab
click the Edit pre-build or Edit post-build button, either is fine
in the window that pops up, click the Macros button
scroll down the list till you find ProjectDir, in the next pane is its actual value
Do a pre/post build step.
Example:
echo $(ProjectDir)
The answer from slugster did not work for me (most possible my fault).
In Visual Studio 2008
right click on your project in the Solution Explorer, select Properties
Go to Configuration Properties and then to Debugging
Click on the arrow in the Command Field and click the Edit Button
In Edit clik "Macros>>" You will see there the values of ProjectDir... etc..
In Visual Studio 2015, you can find ProjectDir by clicking on Macros in additional Include Directories and then clicking on Macros (for me there was nothing in Build Events) :
Open the project properties (Alter+Enter) and then go to "Build Events", select any of the build events, then select "Command Line", click "Edit", then press the "Macros >>" button.
Same here in Visual Studio 2019, you can find ProjectDir by clicking on Macros in additional Include Directories and then clicking on Macros (for me there was nothing in Build Events), like the answer in above Visual Studio 2015.
For me it was the path to the directory containing *.vcxproj file.
From https://learn.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties:
The directory of the project (defined as drive + path); includes the
trailing backslash ''.
Tools -> External Tools
create command for Powershell.exe or Csc.exe
copy exe to c:\ for shorter paths
Name it and check Prompt for arguments
now click Tools -> Click name of your tool
with dialog displayed, click Argument button and choose $(ProjectDir) or whatever.
Your $(ProjectDir) is displayed in Command Line after Powershell.exe or csc.exe
Clear Arguments and click argument button again
Your next selection is display again after command (repeat to view all 16 environment variables.
this is without executing command but command is required to save.
if you use csc.exe from this path
"C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\Roslyn\csc.exe"
copy Roslyn folder to
C:\Roslyn
csc.exe needs other files to work, you need whole directory.
Roslyn folder is only 34 Mb

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.

Resources