Hello I am walking through this tutorial here.
I have created a Console App project in Visual Studio 2017 and have successfully added references to the EmguCV library. However I am struggling with the OpenCv files.
After adding them to the solution, then highlighting them and clicking properties, there is no available option to "Copy to Output Directory".
The properties window only displays the Misc section. How do enable "Copy to Output Directory" for these files in VS 2017?
Copy to Output Directory is a property for files within a Visual Studio project. Select a Windows Form in a project, find Copy to Output Directory and note Copy to Output Directory is set to [Do not copy].
To place all solution outputs in a common directory Click on one project in the solution. On the Project menu, click Properties. In each project, depending on its type, select either Compile or Build, and set the Output path or Base output path to a folder to use for all projects in the solution.
Use the CopyDirectory method to copy a directory to another directory. This method copies the contents of the directory as well as the directory itself. If the target directory does not exist, it will be created.
Copy to Output Directory is a property for files within a Visual Studio project. Select a Windows Form in a project, find Copy to Output Directory and note Copy to Output Directory is set to [Do not copy].
Change the build output directory To open the project's property pages, right-click on the project node in Solution Explorer and select Properties. Select the appropriate tab based on your project type: For C#, select the Build tab.
When files are not located in a project folder Copy to Output Directory does not work as Copy to Output Directory only works on project files. For files, residing outside of the project folder working with Post build events provides the capability to copy files to the build folder of a project.
In addition, when a required file must be included e.g. Excel, text file etc. Copy to Output Directory handles this requirement by setting it to [Copy always], [Copy if Newer] or [Do not copy]. Adding a database to a project from Visual Studio’s Solution Explorer Copy to Output Directory will be set to [Copy always].
The Solution Items are part of the solution folder structure and do no belong to a project, Copy to Output directory relates to a project build, which copies the items to the output directory on a successful build.
In your case, you want to copy those 2 dlls when you build your ConsoleOCR Project, you can use post build events.
Go to your project, right click and select Properties. Then go to Build Events tab, click Edit Post-Build and specify the commands:
xcopy "$(SolutionDir)\opencv_core2410.dll" "$(TargetDir)"
xcopy "$(SolutionDir)\opencv_imgproc2410.dll" "$(TargetDir)"
I assume you use those DLLs as references in your project, you can go to your References in the project and right click them then change the property of Copy Local to True.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With