Quantcast
Channel: Did I just say that out loud? » SharePoint 2010
Viewing all articles
Browse latest Browse all 7

File specified in the modules section of this template already exists.

$
0
0

Ran into a curious issue where I was only able to activate my feature only once after deployment. When I deactivate the feature and then try to activate the feature again, I received the following error :

 Error: A file specified in the modules section of this template already exists.

Resulting in this screen.

Luckily I found the file that was causing the error in the SharePoint logs.

Instantiating module “Style Library”: File already exists at URL “Custom.xsl”, module provisioning failed. 4938b7dd-7642-46aa-9020-a68534c2a726
A file specified in the modules section of this template already exists. 4938b7dd-7642-46aa-9020-a68534c2a726
The element of type ‘Module’ for feature ‘MyCustomFeature’ (id: e2fe1270-6a7e-4461-9542-d8b98a5361c2) threw an exception during activation: A file specified in the modules section of this template already exists.
Feature Activation: Threw an exception, attempting to roll back. Feature ‘MyCustomFeature’ (ID: ‘e2fe1270-6a7e-4461-9542-d8b98a5361c2’). Exception: Microsoft.SharePoint.SPException: A file specified in the modules section of this template already exists

Looking in the elements.xml of my feature I noticed that the attribute “IgnoreIfAlreadyExists” for this file was set to false.

<File Path="Style LibraryCustom.xsl" Type="GhostableInLibrary"  IgnoreIfAlreadyExists="false" />

The MSDN documentation about this attribute states: “To provision even if the file aready exists at the specified URL”. Sounds like my error.

So I changed the attribute “IgnoreIfAlreadyExists” to true and…. no more error. Yeah!

<File Path="Style LibraryCustom.xsl" Type="GhostableInLibrary"  IgnoreIfAlreadyExists="true" />

Hope it helps…


Viewing all articles
Browse latest Browse all 7

Trending Articles