Copying a project file to a known location

Microsoft Visual Studio 2008
Within a Visual Studio C++ solution, you can copy a file to a known location as part of the build process.

To do that, you have so set the “Custom Build Step” parameters found in the Visual Studio project’s property page:

Command line: copy "$(InputPath)" "$(TargetDir)" > nul
Description: Copying $(InputFileName)
Outputs: $(TargetDir)$(InputFileName)

Note, the first line is the actual copy command. If you want to see the command without executing it, you can place @echo in front of the command.

Also note, the second line prints some text to the output screen, so you know what is going on.

For some projects, I have to run Visual Studio in adminstrator mode, otherwise the IDE is unable to copy the file to the restricted location.

I found instructions on how to run Visual Studio in administrative mode at: gottoknow dot com :

  1. Click the ‘Start’ button.
  2. Click ‘All Programs’
  3. In the menu, locate and click on the folder that says ‘Microsoft Visual Studio 2010’ (your version might be 2005, or 2008).
  4. Now right-click on the ‘Microsoft Visual Studio 2010’ program file, which will bring up the ‘Properties’ pop-up box.
  5. Select the ‘Compatibility’ tab, and then in the Privilege Level section, check the box next to “Run this program as an administrator”
  6. Click the ‘Apply’ button, then click the ‘OK’ button.
  7. Now each time you open Microsoft Visual Studio 2010, it will be running in (Administrator) mode.

References:
http://msdn.microsoft.com/en-us/library/b0bktkzs(v=vs.80).aspx

Leave a Reply

Your email address will not be published. Required fields are marked *