Copy files in Visual Studio Post-Build event: Access is denied

2.7k Views Asked by At

I added some copy commands to my project's post-build events. These should copy some template files to the following location:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen

and similar folders.

All of them fail with an Access is denied message.

I tried all of the following:

  • Explicitly set write privileges on folder to my user.
  • Took ownership on the folder (it was at SYSTEM).
  • Started Visual Studio in elevated mode.
  • Turned off UAC (User Access Control)

Still same error. Any ideas?

EDIT: Here's an example:

copy /Y $(ProjectDir)MyFile.xaml "$(DevEnvDir)Extensions\Microsoft\Entity Framework Tools\DBGen\MyFile.xaml"
1

There are 1 best solutions below

0
On

Use Process Monitor to see if it is actually a sharing violation; and that is the source of the Access Denied.