SharePoint Designer “Error Reading File” – Bulk Blank Lines Fix
Getting “Error Reading File” when trying to open a page in SharePoint Designer? Well, it’s a bug! SharePoint designer inserts Blank lines in the aspx file when you edit!!
Fix:
Open the page as text in SPD (or any other Text editor), Remove Blank Lines (Careful! Don’t delete the code. Delete only blank lines). You can select few blank rows, and use Find & Replace!
Here is the screenshot:
Find the blank lines SharePoint designer adds, Remove Empty rows from the file.
There is a utility in codeplex: https://sharepointfilerepair.codeplex.com/
A detailed explanation of the cause of the issue can be found here:
https://strangecodestuff.blogspot.com/2015/02/solved-sharepoint-designer-inserting.html
Basically – SharePoint Designer is inserting blank lines. This behavior occurs around lines of literal-text within tag-blocks. In Designer every “SharePoint:ScriptBlock” and “SharePoint:StyleBlock” tag will experience this issue.
The solution is to decorate the literal-text with the HTML Script (or Style) tags. (More often than not these opening and closing tags are missing) It is crucial that the opening HTML tag is on the same line as the “SharePoint:…block” tag. If you put it on it’s own line the problem will persist. The above text changes are necessary for every “SharePoint:…block” tag on the page.
Now the issue is fixed. Save as many times as you want – no more blank lines are inserted.