EDIT: This is a VS2008 app written in C#.
So I have a folder in my solution called
_lib/
It's where I keep my DLLs so that when I reference them, they get built into the bin/
folder.
Now I have a new item in my solution. It's a DLL but shouldn't be reference (it's required for a 3rd party app). So on build I want this to be copied from _lib/
to bin/
but NOT referenced in the project.
I've included the _lib/
folder in my app, and for the properties of that DLL I selected always copy. This ALMOST worked, it copies the file with the folder, so my structure looks like:
/bin/_lib/thedll.dll
Instead of
/bin/thedll.dll
Any ideas?
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.
In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.
This is the "show all files" button. Click that and you'll see all the files in your currently selected project (it is project-specific). Highlight any files that you want to include, right-click, and select "Include in Project."
$(OutDir) is a Visual Studio Build Property Macro. You can see the values of macros using the Macros >> button in many Properties dialogs. For instance, in Properties->General->Output Directory, click the dropdown in the value text box, choose Edit..., and in the resulting dialog, click the Macros >> button.
Try following these steps in Visual Studio:
Expand the project tree concerned
Double click the Properties
element
In the opened window click the Build Events
tab
In the Post-build event command line
text area place this:
xcopy "$(ProjectDir)_lib\file.ext" "$(ProjectDir)bin\$(ConfigurationName)"
Open the expected output folder alongside Visual Studio
Hit CTRL+Shift+B to make sure everything is saved and build
Feel the sense of achievement well up inside you as your file appears
:)
Oh, and you can now set Copy to output directory
to Do not copy
.
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