December 20, 2011

Error When Deploying a Custom Solution in SharePoint 2010

This is an error I received when trying to deploy a SharePoint 2010 with a custom site definition in my development environment

Error

"PMS_FG" and "PMS_FG" contain a file that deploys to the same Package location: PMS\PMS_FG\documents.aspx    D:\Users\dalzoubi\Solutions\PMIS\Spectra.PMS2010\Package\Package.package

image

Looking at the folder PMS_FG\, there is only one document.aspx file!!!

image

So that did not make sense at first site, so  I decided to open the Visual Studio Project Item Data file that represents the site definition to see what is going wrong in there.

Solution

1. In Solution Explorer, right click the Site Definitions and click Open Folder in Windows Explorer

image

2. In explorer view, double click SharePointProjectItem.spdata, select Select a program from a list of installed programs, click OK

3. Select Notepad, uncheck Always use the selected program to open this kind of file.

4. Click OK

5. Notepad opens and right there you will notice one element that is different than the other elements:

image

6. Remove that element, Save and close your file.

image

7. Go back to Visual Studio, you will be asked to reload that file, click Yes to All

image

8. Now try to deploy your solution, you should no longer have that error.

Happy coding!

4 comments:

  1. Thanks for your great article ... it saves my lots of time and efforts ...

    Thanks again buddy...

    keep blogging..!!!

    ReplyDelete
  2. It Works for me ...

    Let me share you a actual reason for this as I understand.

    Here there is not a problem due to there are two file with the same name trying to deploy on the same package.

    But the actual problem is , there are two entries for the same file in the .spdata file.

    That is why this kind of error comes when try to deploy the solution.

    Right Dennis...

    Please correct me if I am wrong ..

    Thanks ..!!!

    ReplyDelete
  3. Dhiraj,
    I am glad I am able to help.
    You are correct, it's due to having two entries for the same file. It's some sort of a bug that happens when you move things around.

    Dennis

    ReplyDelete
  4. Hi Dennis,
    Thanks a lot for the solution.
    I was able to replicate the error when setting Deployment type of my aspx file to "No Deployment" then again Set Deployment type back to "Element file".

    ReplyDelete