Error occurred in deployment step 'Activate Features': Cannot complete this action
-
21-12-2019 - |
Question
i'm new on sharepoint 2013:
In my sharepoint solution which is created from visual studio , I created a project that contains the data model of my solution : I put in this project custom fields, custom types as well as custom lists that my solution requires.
then I created 3 features in this project :
The first feature which is a site scoped feature contains all custom types and custom fields of my solution, its name is Feature_ContentTypes_Fields.
The second feature which is a Site Scoped feature contains all list definitions of my custom lists ( in which I added "its name is Feature_ContentTypes_Fields" as feature activation dependency) , its name is Feature_ListDefinitions.
The last feature which is a web scoped feature contains all list instances of my custom lists ( in which I added "Feature_ListDefinitions" as feature activation dependency) , its name is Feature_ListInstances.
Result :
1/ successful build.
2/ failed deploy
Here is the output of visual studio while deploying the solution:
------ Build started: Project: Model, Configuration: Debug Any CPU ------ Model -> C:\Users\myusername\Desktop\ProxymSPIntranet\SPIntranet\Model\bin\Debug\Model.dll Successfully created package at: C:\Users\myusername\Desktop\ProxymSPIntranet\SPIntranet\Model\bin\Debug\Model.wsp ------ Deploy started: Project: Model, Configuration: Debug Any CPU ------ Active Deployment Configuration: Default Skipping deployment step because a pre-deployment command is not specified. Recycle IIS Application Pool: Recycling IIS application pool 'SharePoint - 1111'... Retract Solution: Deactivating feature 'Model_Feature_ListDefinitions' ... Deactivating feature 'Model_Feature_ContentTypes_Fields' ... Retracting solution 'model.wsp'... Deleting solution 'model.wsp'... Add Solution:
Adding solution 'Model.wsp'... Deploying solution 'Model.wsp'...
Activate Features: Activating feature 'Feature_ContentTypes_Fields' ... Activating feature 'Feature_ListDefinitions' ... Activating feature 'Feature_ListInstances' ... Error occurred in deployment step 'Activate Features': Cannot complete this action.Please try again. ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ========== ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Can anyone help me please ?
Solution
check if the list instance is included in any other features because when you add a sp related item to the solution visual studio automatically adds it to a feature.
-or-
Elements File of the List Definition Should Contain The Below:
<ListTemplate
Type="10999"
Check if they are in line with the List Instance's Element File Attribute As Below:
<ListInstance
TemplateType="10999"
They should be the same. Similarly The Content Type Element File would have The Below Attribute:
<ContentType ID="0x0100E8F7E7893379472DB2522B0FCDF0C836"
This should be the same as the Content Type ID inside the list instance's Schema.xml file:
<List Url="Lists/FlatStructuredNavigationListDefinition" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE" RootWebOnly="TRUE">
<MetaData>
<ContentTypes>
<ContentType ID="0x0100E8F7E7893379472DB2522B0FCDF0C836"
Check These and Deploy This should Work i had the same issue.
OTHER TIPS
In my case the problem with deploying was related to the Name attribute of the Field nodes. I had Name attributes with spaces, which SharePoint somehow didn't like. No error was given, but I noticed that when I commented out the Field nodes in the Schema.xml file deploying worked. So I spent a lot of time trying to debug this, and finally I found out that deleting the spaces did the trick. So instead of writing
< Field Name="My Field Name" >
write
< Field Name="MyFieldName" >