Question

This issue was resolved with SQL Server 2008 R2 Cumulative Update 5 / SP1 / SQL Server 2012 RTM


On occassion when I try to build a Reporting Services project as part of either deploying or previewing a report in Visual Studios I receive the following error:

Access to the path 'C:\My Solution Folder\bin\Debug\My Report.rdl' is denied.

What appears to happen is the file in the \bin\Debug\ folder has been changed to read-only. I can "fix" the symptom by removing the read-only flag on the impacted file. I would like to find a way to avoid this error altogether since this happens usually multiple times a day.

I verified the file is not being saved to my source control system, so it doesn't seem like my source control plugin would cause this problem. The problem seems to have started with SQL Server 2008 R2 and this makes sense given that I am pretty certain the \bin\Debug\ folders didn't exist prior to this version of the Reporting Services project.

I tried changing the project OutputPath to a path that is not under the project folder, but Visual Studios would't allow me to do this.

Was it helpful?

Solution

It's a known bug with Microsoft that was corrected by CU5 and later in SP1. The issue did not occur at all in SQL Server 2012 RTM.

https://connect.microsoft.com/SQLServer/feedback/details/543755/fiserv-tap-checking-it-rdl-source-sets-output-folder-to-read-only

Basic workaround is to build once, unset the read-only attribute on all files in the reporting project's BIN folder and it'll all work again...until you edit a file again.

I suspect this is due to VSS marking files as read-only once checked in...VS then copies the resources (*.RDL) to the BIN folder verbatim i.e. with read-only attribute set.

OTHER TIPS

You can use Process Monitor to find out which process changes that. All you need to do is set up a filter with full path the file in interest and watch for any operations done on this file. Also turn off all the other monitors like registry and network. They are on the the main toolbar on the right.

The following isn't a fix, persay, but it's a workaround that doesn't get much better until your server is updated. Constantly deleting the bin folders for projects got old real fast and I'm stuck on a server instance with the issue, and it seemed like a good job for a simple batch script.

It just recursively deletes every folder named 'bin' in your project directory.

BINZAP.bat

  1. Create a new text file in your windows\users\YOURNAME directory
    • This location allows easy access from a normal cmd prompt if needed.
  2. Paste in the code block below this list
    • Replace the ellipsis with your system's path
  3. Save it as BINZAP.bat (good naming is very important)
  4. Right click on your desktop.
  5. Create a new shortcut.
  6. Point it to the batch script.
  7. Right click the short cut and click in the “Shortcut key” text box
  8. Press Z, or another key if that key chord is already assigned to something else.

@echo off
cd "C:\ ... \Reports"
for /d /r . %%d in (bin) do @if exist "%%d" rd /s/q "%%d"
echo.
echo All your bin are belong to us.
echo.
pause
exit

If you've done this correctly, you can now simply press CTRL+ALT+Z, or whichever key you chose, from Visual Studio whenever you get the error. Much easier!

Enjoy!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top