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.
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
Thanks,
Ricky A
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.
Regards
Simon