We have a VS project module with 'IgnoreIfAlreadyExists' set to true.

What this means is that: if a similar file exists then it will ignore this VS file. However, whenever we make change to the file in module (masterpage), we can see that the master page does get updated.

Why do changes happen when IgnoreIfAlreadyExists is set to true?

3 Answers 3


You have got it mixed up!

If set to true it will provision even if the file already exists!

Optional Boolean. TRUE to provision the view even if the file aready exists at the specified URL; otherwise, FALSE http://msdn.microsoft.com/en-us/library/ms459213.aspx

  • Is it good practice to set this to true..?
    – variable
    Apr 3, 2014 at 7:12
  • 3
    @variable Yes. When set to true you don't have to manually upload, check-in and publish the new files. I have never been in a situation where setting it to false was desired.
    – user2536
    Apr 3, 2014 at 7:47

Things is a little more complex than the other answers suggest:

Only controls whether activating the feature should fail if the file already exists.

Usually you want to set it to true as that'll allow you to activate/deactivate the feature without problems. But be aware that it'll NEVER update the file content nor properties by itself.

Usually you'll set this to true, so you're able to reactivate the feature. But this comes with the risk of your feature thinking that it got it's file deployed when what really exist is a user file with that url. So you might want to use the value false if your feature cleans up after itself when being deactivated and you want to stop activating the feature if the file already exists.

The attribute is ignored if ReplaceContent is set to true.

Controls whether activating the feature should revert a customized (Unghosted) file to being uncustomized (Ghosted) AND set properties as specified. May fail if checked out by other user.

Ghosting of files
The attributes above are only in effect when the feature is being (re)activated which probably isn't what's happening to you.

What's happening to you is that when you deploy files to SharePoint using File element in Module elements what SharePoint creates in the Content Database is just a record telling that the file exists in this Document Library but with a pointer into the location in SharePointRoot where the file content is read from. This is called that the file is Uncustomized (Ghosted).

If someone goes and modifies the file using SharePoint UI (or object model) the modified content will be stored in the Content Database and read from here. This is called that the file is Customized (Unghosted).

If the file stays Uncustomized (Ghosted) as most files do, then the mere act of deploying (updating) a WSP with new content will change the file in SharePointRoot and thereby update what is read (used) without the feature being reactivated and this will happen regardless of the value of the above attributes.

  • @Per Thanks for the answer. Clarified a lot of doubts. But the files which I have attached to a module are getting deleted and reuploaded on deploying. Is there a way to stop that? I tried setting both IgnoreIfAlreadyExists which throws an error on "False" and ReplaceContent="False" but it still deletes all the files and reuploads them.
    – Akhoy
    Dec 21, 2015 at 19:43

Besides Roberts's answer, if you are using SP2013 there is one more attribute ReplaceContent. You might want to use it. From MSDN

Optional Boolean. TRUE to overwrite the previously installed version of the file with a new version when the element manifest is being applied as part of an upgrade of the parent Feature; otherwise FALSE.

For the difference between the two check this link

  • IgnoreIfAlreadyExists also does the replace anyways right? just asking.
    – variable
    Apr 3, 2014 at 7:28
  • Correct, this ReplaceContent switch is a bit more powerful in some scenarios :) Apr 3, 2014 at 7:49
  • No IgnoreIfAlreadyExists does not replace. Please see the link I have attached in the answer above.
    – Garima
    Apr 3, 2014 at 8:48
  • I never said it would replace, I said it would successfully activate Apr 3, 2014 at 9:09
  • oh sorry the above comment was for @variable not you. My bad :-)
    – Garima
    Apr 3, 2014 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.