I am using SPD 2013 to edit a custom master page for Sharepoint 2013. I have a publishing site setup in a dev environment for my testing. Everytime I edit and save my master file, it adds literally thousands of blank lines into my file making it nearly unusable to edit. The file loads slow and is up to about 200000 lines. Is this a known bug, or is there a fix? Right now can't see how I can get around this?

Same will happen when i add service datasource to sharepoint page using sharepoint designer.


This behavior ("SharePoint Designer Inserting Blank Lines") 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 simply add an HTML/XML comment tag right after the block tags...

<SharePoint:ScriptBlock runat="server"><!---->


<SharePoint:StyleBlock runat="server"><!---->

CRUCIAL! Make sure that the comment tag is on the same line as the <SharePoint:...block> tag. If you put it on it's own line the problem will persist. These 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 will be inserted between these tags

Exact instructions and repeatable demonstration of the issue can be found here...


SharePoint designer as we all now is not the best tool to work directly with files. To work correctly with the master page I suggest that you use a branding package in Visual Studio and deploy the master page to SharePoint. (SPD is also known as SharePoint Destroyer) If you create a branding package then you can also reap the benifits of re-using the branding in whatever installation you want.


  • Thanks Magnus for your input. What is the best approach to first design the master page? Do you yourself use Sharepoint Designer? – binga30 Mar 4 '13 at 23:32
  • I do not use SharePoint Designer besides when I want to do a quick test in my own dev enviroment. You can easily work with the master page and css from VS if you deploy it to the hive which I think is the best approach if you don't work in a sandboxed env (app). blog.drisgill.com has a good starting master page which can be used as first approach. You can find lots of my branding thoughts and best practices in sharepointfront.com if you are interested. – Magnus Hansson Mar 5 '13 at 8:57

This also happen when you add service datasource on the page, adding comment to above mentioned block did not solve my issue. Solution work for me is that

  • Check the code where exactly lines are adding
  • If the lines are adding like below

  • Change it to

  • Then automatic formatting engine will not add any line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.