I am currently trying automate Deploying of Branding changes to out Business Intelligence SharePoint site through PowerShell. I am using the following code to Deploy a WSP to my local instance of SharePoint for testing.
function Uninstall-AllSPSolutions {
param (
[switch] $Local,
[switch] $Confirm
)
Start-SPAssignment -Global;
foreach($solution in (Get-SPSolution | Where-Object { $_.Deployed })) {
write-host "Uninstalling Solution " $solution.Name;
if($solution.DeployedWebApplications.Count -gt 0) {
Uninstall-SPSolution $solution -AllWebApplications -Local:$Local -Confirm:$Confirm;
} else {
Uninstall-SPSolution $solution -Local:$Local -Confirm:$Confirm;
}
do {
Start-Sleep 5;
$solution = Get-SPSolution $solution;
} while($solution.JobExists -and $solution.Deployed)
}
Stop-SPAssignment -Global;
}
function Remove-AllSPSolutions {
param (
[switch] $Confirm
)
Get-SPSolution | Where-Object { !$_.Deployed } | Remove-SPSolution -Confirm:$Confirm
}
echo "Loading Sharepoint Snapin"
$snapin = Get-PSSnapin | Where-Object { $_.Name -eq "Microsoft.SharePoint.Powershell" }
if ($snapin -eq $null) {
Write-Host "[INIT] Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
#Some variables
#Include Url Site
$SITEURL="sharepoint url"
#Include WSP File Path
$WSPFILEPATH="C:\Users\Administrator\Desktop\folder\SharepointDeployer.wsp"
#Include WSP Name
$WSPNAME="SharepointDeployer.wsp"
echo "Uninstall Solutions"
Uninstall-AllSPSolutions -Confirm
echo "Remove Solutions"
Remove-AllSPSolutions -Confirm
echo Deploy Test solution
echo "1. Add Solution"
Add-SPSolution $WSPFILEPATH
echo "2. Deploy Solution"
#Install-SPSolution -identity $WSPNAME -force -AllWebApplications $SITEURL -GACDeployment
Install-SPSolution -identity $WSPNAME -force -AllWebApplications -GACDeployment
echo "2. Enable Feature"
Enable-SPFeature –Identity "SharepointDeployer Feature1" –url $SITEURL
The solution deploys just fine, as I can see it in in Central Admin, but the changes do not get made to the files when I look in SharePoint Designer.
All of the files have the following attributes to overwrite in the Module
IgnoreIfAlreadyExists="true" Type="GhostableInLibrary"
I have tried playing around with the Feature to see if it is an issue there, here are the results
Farm: I cannot generate the WSP through Visual Studio. The error is The Project Item "Name of Module" cannot be deployed through a Feature with Farm Scope
Site: The Feature is not a Farm Level Feature and is not found in a Site Level defined by the Url
Web: Same as above
WebApplication: I get the same error as Farm except it says WebApplication Scope
I am not sure what I need to do to make this work, as it should be simple (we are talking 3 CSS files, 2 images, and a masterpage)
Any help would be really appreciated.
In my opinion there are two possible reasons for the resources to stay outdated
good kuck
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.