views:

446

answers:

3

Is there a way to set visual studio to publish all pdf files?

I know that you can set each indivdual pdf file in a project with the "Copy to Outpub Directory" property.

But that means doing the same thing 100's of times for my current project, is there a way to change a global setting to do the same thing?

A: 

You could edit your project file directly to add the required <CopyToOutputDirectory>Always</CopyToOutputDirectory> elements to the PDF files. (If your project isn't under source control, test on a copy first and keep backups in case it all goes wrong)

Stuart Dunkeld
+1  A: 

Add a post build event with the following command:

xcopy "$(ProjectDir)myPdfs\*.pdf" "$(TargetDir)myPdfs\" /S /Y

Note in the above command myPdfs is just a subfolder of your project directory that contains all the PDF files. If you have more than one of these subfolders you need to run the command for each.

Hope this works!!

scott
Looks like this is the best option.
TheAlbear
A: 

there is an easier way, you have to make sure your file is included in the project first, then right-click on the file go to properties, there will be an option "copy to output directory", choose "copy always"

Good luck

Dmitry.Alk