Monday, October 10, 2011

SharePoint Server 2010 - Deployment conflicts - Could not delete file

Here is what I did:
1. I created one module in VS 2010.
2. I added one master page inside the module
3. I modified the Elements.xml file of the module as:

4. Then I created a feature for this module.
5. My target was to deploy the module so that I can use my custom master page for my site.

Here is what I Got when trying to deploy from VS 2010:
1. When I 1st time deployed the solution it worked fine. and I found my new master page in place.
2. When I did little modification into the master page and tried to deploy again, I got the following error:
3. I was digging with the problem. I found that if I do not use the master page from any site, I can deploy the solution. So, One solution could be before each deployment change the master page of the site, then deploy and then get the master page selected back for the site. 
4. But the solution was not acceptable and comfortable. So, I continued digging the issue and finally came to a solution.
Here is what I did to solve the issue:
1st of all it seems the issue was caused by a possible bug of VS 2010. If you go to the property window of the specific folder you will see Deployment Conflict Resolution is set to automatic. Which was the expected value for me.

 As it was not working, I changed the value to prompt. Then, I started to get prompt about the conflict. If I click the button to resolve the conflict automatically, I found the issue is solved and it worked.

Still, to me, the solution was not 100% acceptable as getting a prompt in every deploy was frustrating. Later, I change the value to "None". It was not an acceptable value at all to my consideration. but surprisingly it solved the problem. So, ISSUE RESOLVED! 

In Summary: 
1. Right click the folder/list of your concern.
2. Go to properties
3. Set Deployment conflict resolution to "None".

4. Deploy and have fun with SharePoint :)


  1. Thnx it's work, well.

    1. : thnx it's help well.