Visual Studio SharePoint Packaging Issue: Both "SharePointItem" and "SharePointItem" contains a file that deploys to the same Package location.

I have had this problem a few times when moving and copying SharePoint SPI objects within Visual Studio 2010.

When you attempt to package and deploy your SharePoint solution the following error occurs:-

  • C:\TFSBulid\4\Project\BuildLocation\Sources\ProjectName\Package\Package.package: Both “[ExampleSiteDefinition]” and “[ExampleSiteDefinition]” contain a file that deploys to the same Package location: [Location]

The problem occurs because two of the SharePoint Project Item (SPI) have references to the same location. This seems to occur when you copy SharePoint Project Items.

If you take a look at the SharePointProjectItem.spdata file for the SharePoint Project Item that you copied from the SharePoint Point Item specified in the [Location] portion of the error message you will see that the SharePointProjectItem.spdata file will show details of the old SharePoint Project Item rather then the new SharePoint Item.

The content of the SharePointProjectItem.spdata looks like this:-

 1: <?xmlversion="1.0"encoding="utf-8"?>
 2: <ProjectItemType="Microsoft.VisualStudio.SharePoint.SiteDefinition" DefaultFile="onet.xml" SupportedTrustLevels="FullTrust" SupportedDeploymentScopes="Package"
 3: xmlns=>
 4: <Files>
 5: <ProjectItemFileSource="default.aspx" Target="SiteTemplates\ExampleSiteDefinition\"
Type="TemplateFile" />
 6: <ProjectItemFileSource="onet.xml" Target="SiteTemplates\ExampleSiteDefinition\Xml\"
Type="TemplateFile" />
 7: <ProjectItemFileSource="webtemp_ExampleSiteDefinition.xml" Target="1033\XML\"
 8: </Files>
 9: </ProjectItem>

To fix this update the ProjectItemFileSource element’s Target attribute to point to the correct location.


  1. Hi Simon,
    I am encountering the same issue.
    This occurs if i set deployment type of my aspx files inside module element to “No Deployment” then some entry is created in spdata file as
    ProjectItemFile Source=”..\PageModule\Lists\Interview\InterviewBrowse.aspx” Target=”PageModule\Lists\Interview\” Type=”ElementFile” />

    if i change deployment type to Element File then additional entry is created as

    The only solution has been to modify the spdata file and remove the repeated entries

    Any help would be appreciated

    Ricky A


    1. Hi Ricky,
      Apologies for the delay in getting back to you.
      Yes I have seen this issue when copying the files through Visual Studio. I updated the spdata file and remove the duplicate entry.



Thoughts? Comments about this post? Please leave them here..

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s