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=http://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel>
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\" Type="TemplateFile"/>
8: </Files>
9: </ProjectItem>
To fix this update the ProjectItemFileSource element’s Target attribute to point to the correct location.