We have found a problem with our deployment to a production server that runs Sharepoint 2010 Publishing Site Collection.
We are deploying WSP packaged from Visual Studio to Sharepoint Management Shell (Uninstall, reinstall solution). It has worked like a charm in the past. We added a custom masterpage, css files, images and later we successfully added custom page layouts.
I also have SP running locally on my computer and everything works fine with no problem adding new files via deploying Feature. I can add them neatly into a document library or even create new folders from the Elements file.
However the problem arise when I deploy my WSP to the production server. I want to add a few JS files and a XSL file to the Style Library but the files won't get added to the document library. The deployment process goes smooth though with no errors and when I check my feature in Sharepoint Hive, the new files are there on the physical drive! However they won't get added to the virtual Document Library.
I can update existing files like the masterpage and CSS files so the feature that is deployed is working.
My guess is that either it has to do with permission problems or some bug in my code. But I did exactly as we have done before when deploying.
This is how my Elements.xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ALayout" Url="_catalogs/masterpage" RootWebOnly="true" >
<File Path="ALayout\_a_intra.master" Url="_a_intra.master" Type="GhostableInLibrary" />
</Module>
<Module Name="ALayoutStyles" Url="Style Library" RootWebOnly="true" >
<File Path="ALayout\styles\z_aintra_core.css" Url="z_aintra_core.css" />
<File Path="ALayout\styles\aintra_std.css" Url="aintra_std.css" />
</Module>
<Module Name="ALayoutStyleImages" Url="Style Library/img" RootWebOnly="true" >
<File Path="ALayout\styles\img\a-logobig.png" Url="a-logobig.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\bg.png" Url="bg.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\divider.png" Url="divider.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-bg-hovered.png" Url="nav-bg-hovered.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-bg-radius-left.png" Url="nav-bg-radius-left.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-bg-radius-right.png" Url="nav-bg-radius-right.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-bg-selected.png" Url="nav-bg-selected.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-bg.png" Url="nav-bg.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\nav-divider.png" Url="nav-divider.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\top_bg.png" Url="top_bg.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\user-account-radius-left.png" Url="user-account-radius-left.png" Type="GhostableInLibrary" />
<File Path="ALayout\styles\img\user-account-radius-right.png" Url="user-account-radius-right.png" Type="GhostableInLibrary" />
</Module>
<Module Name="ALayoutScript" Url="Style Library/js" RootWebOnly="true" >
<File Path="ALayout\js\script.js" Url="script.js" Type="GhostableInLibrary" />
<File Path="ALayout\js\plugins.js" Url="plugins.js" Type="GhostableInLibrary" />
</Module>
<Module Name="ALayoutScriptLibs" Url="Style Library/js/libs" RootWebOnly="true" >
<File Path="ALayout\js\libs\jquery-1.4.2.min.js" Url="jquery-1.4.2.min.js" Type="GhostableInLibrary" />
</Module>
</Elements>
The last two modules (for Javascript) is the ones I can't deploy to the document library. I tried different document libraries but it still doesn't work on production server, just locally. And I can't deploy to Sharepoint Hive via Feature.
Anyone can think of something I missed?
Wow, the solution was simple. I deactivated the feature in Sharepoint administration, and reactivated it and the new files got deployed.
WHY this happened, I don't know. If I version my feature instead of uninstall->add it might get fixed? Why is the behavior different on the production farm vs local? etc.