When I deploy my project from visual studio everything is fine, I have a module with some pictures in it and a stylesheet that get replaced on deployment, from the output window:
Retracting solution 'xxx.web.wsp'...
Deleting solution 'xxx.web.wsp'...
Add Solution:
Found 3 deployment conflict(s). Resolving conflicts ...
Deleted file 'http://server/SiteAssets/Style.css' from server.
Deleted file 'http://server/SiteAssets/pic1.png' from server.
Deleted file 'http://server/SiteAssets/pic2.png' from server.
Adding solution 'xxx.web.wsp'...
Deploying solution 'xxx.web.wsp'...
Activate Features:
Activating feature 'Feature1'
Feature1 adds the images back.
However, when I deploy with PowerShell the images/stylesheet are not replaced. I am not sure what I am missing as I deactivate the feature, retract/remove the solution, add/install the solution and activate the feature but the stylesheet and images have not been updated.
Some PS (I have multiple site collections):
$webs = get-spsite -webapplication "http://server/" -Limit All
$wsp = "xxx.web.wsp"
$path = "C:\xxx.web.wsp"
$Solution = Get-SPSolution | ? {($_.Name -eq $wsp) -and ($_.Deployed -eq $true)}
$feature1 = Get-SPFeature "d56ba933-9c24-440c-9470-1da208c3085e"
$webs | Get-SPSite -limit all | ForEach-Object {
if ($_.Features[$feature1.ID]) {
Disable-SPFeature $feature1 -Url $_.Url -Force -Confirm:$false
}
}
Uninstall-SPFeature $feature1 -Confirm:$false
Uninstall-SPSolution -Identity $wsp -AllWebApplications -Confirm:$false
Write "Uninstalling"
while ($Solution.JobExists)
{
Start-Sleep 2
Write "."
}
Write "Removing solution"
Remove-SPSolution -Identity $wsp -Confirm:$false
Write "Adding solution"
Add-SPSolution -LiteralPath $path
Write "Installing solution"
Install-SPSolution -Identity $wsp -GACDeployment -AllWebApplications -Force
while ($Solution.JobExists)
{
Start-Sleep 2
Write "."
}
write "Activate features"
$feature = "d56ba933-9c24-440c-9470-1da208c3085e"
Foreach ($oneweb in $webs)
{
write-host $oneweb
$siteFeature = get-spfeature -site $oneweb | Where {$_.id -eq $feature}
if ($siteFeature -eq $null)
{
Enable-SPFeature -Identity $feature -URL $oneweb.URL -Confirm:$False -Force
}
else
{
Write-Host "Feature $feature is already activated on $oneweb" -foregroundcolor green
}
}
How come Visual Studio deployment deletes the images but powershell doesn't?
Thanks in advance.