If you create an MSDeploy package for a SharePoint or O365 AddIn (a.k.a App) in a team build the package does not include all files (like i.e. language resources).
This seems to be a bug in MSDeploy. If you build the app only with /p:Ispackaging=True everything works fine. You get a web package inside the app.publish folder that contains all files.
If you work with multiple Publishing Profiles and specify an explicit profile strange things happen.
You still get the package but if you look inside the package the folders are missing.
If you can switch back to only using /P:IsPublishing=True your good. If not you have to look for the correct package.
If you use Build.VNext the package is in the source folder of your web project. You can use a copy file task to copy it to the staging directory before publishing your build artifacts.
If you use the classic XAML Builds you have to look for a _PublishedWebsites folder in your output (Binaries) directory.
I hope this helps. This fooled me in some projects yet.
4 thoughts on “Missing files in MSDeploy package”
I would like to know how to do with with a SharePoint hosted app. (Automate the deployment of the SharePoint hosted app)
To build the package you just need to add /p:IsPublishing=True
To deploy the app you have to enable side loading:
function Install-App($clientContext, $appPackage)
$appName = [System.IO.Path]::GetFileNameWithoutExtension($appPackage)
$web = $clientContext.Web
Write-Verbose "Start to install app $appName..."
$productId = Get-ProductId $appPackage
Write-Error "Cannot find product Id of app $appName."
# Try to uninstall any existing app instances first.
Uninstall-App $clientContext $productId
Write-Verbose "Installing app $appName..."
$appInstance = $web.LoadAndInstallAppInSpecifiedLocale(([System.IO.FileInfo]$appPackage).OpenRead(), $web.Language)
$appInstance = WaitForAppOperationComplete $clientContext $appInstance.Id
if (!$appInstance -Or $appInstance.Status -ne [Microsoft.SharePoint.Client.AppInstanceStatus]::Installed)
if ($appInstance -And $appInstance.Id)
Write-Error "App installation failed. To check app details, go to '$($web.Url.TrimEnd('/'))/_layouts/15/AppMonitoringDetails.aspx?AppInstanceId=$($appInstance.Id)'."
throw "App installation failed."
Here is a full script to deploy an app: https://github.com/wulfland/ScriptRepository/blob/master/Apps/Apps/Install-SPAddIn/Install-SPAddIn.ps1
I also have scripts to trust the app using ie Automation. If your intrested, then let me know. But ie automation is pretty fragile. It’s to easy to get it running.