I have a weird issue with deployment of a WSP file.

A little background info:

  • The Visual Studio solutions consists of 28 projects (don't ask... I inherited it :-)) of which 26 files generate a WSP file.
  • The project was started on SharePoint 2007 but is now being upgraded to SharePoint 2010
  • All projects build their WSP files using stsdev. Converting the projects to the SharePoint 2010 project templates will take too much time.
  • TFS is used for version control and ALM
  • Nightly (debug) build is in place to build all the WSP files.
  • From the nightly build, a PowerShell script is started which initiates Update-SPSolution for each WSP file and waits until the updating is completed before starting the update process for the next file.

In one of the projects, several application files are deployed to a sub folder of _layouts, including a custom master page used exclusively by the application pages. The master page is not deployed to the Master Page Gallery and is not used anywhere else.

Last week, a rather peculiar problem started to show up: the last character of the master page was appearing twice. At first I thought this was a mistake in the master page (it had recently been edited) so I opened up Visual Studio, got the latest version, went into the master page and looked at the last line: </HTML> which was followed by a new line. The version that was deployed said </HTML> followed by a new line and then >. Weird.

Since I have two test environments that are both updated nightly, I looked at both the environments and discovered that both had the same error in the same file. As the error was not in TFS, I turned to the build server and investigated the files in the Sources folder, they were fine. I looked into the built WSP files, they were fine as well.

I have tried manually running the Update-SPSolution command but the issue remained. Redeploying (retract/delete/install/deploy) did not resolve the issue either. I've checked the properties of the master page file on the disk drive, but couldn't find any indication that the file might have been changed by someone else ("Last Modified" time was equal to the other files, no changes in permissions, etc).

Yesterday, I made a small change to the master page, hoping to trick the job that does the actual solution deployment into re-deploying the file. I made these changes:

  • I added a space on top of the file. It started with <%@Master which I changed into <%@ Master
  • I removed the newline at the bottom of the file

This morning, when the nightly deployment had ran, I looked at the bottom of the file. To my amazement, it read: </HTML>ML>

The issue occurs on two separate but identical SharePoint environments. Both environments have been configured by using scripts and are up onto the same SharePoint patch level: SP 2010 + Service Pack 1 + the August cumulative update (14.0.6126.5000).

I think I have tried almost everything. Can anyone give me some clues on how I can possibly resolve this very peculiar issue?

  • take one of the nightly build WSP files, change the .wsp to .cab, and use an appropriate archive program to extract it and see what's being packaged up. If the error is inside the WSP file, that would at least be meaningful. – bkwdesign Dec 11 '12 at 16:24
  • Thanks for your reply. I've tried that, unfortunately the master page is fine when I extract it from the WSP file. – Alex Dec 12 '12 at 8:34
  • so it sounds like the problem exists in the actual environments where you are deploying. Yuck. What happens when you make a change so that the new WSP master source is longer than the currently deployed file (let's say you add a random <!-- HTML COMMENT --> ). It almost looked to me that your first change (which perhaps shortend row count.. perhaps byte count) allowed chars to show up.. as if a smaller amount of text was being pasted over a larger amount of text. So, my theory is, 'try pasting in a larger amount of text'. Not really a solution, more of an experiment. Maybe worth trying. – bkwdesign Dec 13 '12 at 15:34
  • I tried that and even then it repeats the last 3 characters of the file. I've tried it in 4 environments (3 with the same patch level, 1 with an older patch level) and it happens on all of them. I've added some newlines to the end of the file, now it just replicates newlines. Not the desired solution but at least it prevents wrong output. – Alex Dec 14 '12 at 7:56

Your Answer

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

Browse other questions tagged or ask your own question.