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 tim开发者_如何学编程es 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.
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.
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
- Create a new text file in your windows\users\YOURNAME directory
- This location allows easy access from a normal cmd prompt if needed.
- Paste in the code block below this list
- Replace the ellipsis with your system's path
- Save it as BINZAP.bat (good naming is very important)
- Right click on your desktop.
- Create a new shortcut.
- Point it to the batch script.
- Right click the short cut and click in the “Shortcut key” text box
- 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!
精彩评论