MVC6 app VSO build and deployment to Azure fails - asp.net-core-mvc

I'm having trouble deploying my first MVC6 app to Azure from Visual Studio online. I've created a build definition that creates a deployment package and an "Azure app service deploy" task to deploy that package. The deployment task reports this error:
Failed to deploy App Service.
Error: (2/17/2017 9:09:59 AM) An error occurred when the request was processed on the remote computer.
Error: Source (sitemanifest) and destination (contentPath) are not compatible for the given operation.
Error count: 1.
Successfully updated deployment History at https://xxx.scm.azurewebsites.net/deployments/5121487351399775
Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
I can build an deploy the package from within Visual Studio. I have built and deployed a handful of MVC5 apps successfully with the same technique. I've never had a problem, so I'm not sure where to start figuring this out. Any ideas?
Thanks!

Related

Error occurs when deploying the UWP application (installedLocation != null)

Introduction
The project was newly created and there was no change in the project.
The build of the application when running the application in JetBrains Rider IDE was executed.
Successful Build
The build completed successfully
0>------- Finished building project: TEST. Succeeded: True. Errors: 0. Warnings: 0
Build completed in 00:00:34.171
Build succeeded at 04:11:43
Failed Deployment
The deployment was not completed successfully.
Deploying file MainPage.xbf...
Deploying file WinMetadata\Windows.winmd...
Deploying file resources.pri...
Deploying file TEST.exe...
installedLocation != null
I was facing the same issue when I changed IDE from VS to Rider. The problem was that I had a project with the same name in VS and it had been previously built, but I could not have found the deployed application. So I looked up for this VS project, built it, and then I deleted the application with the VS solution together. After this, I could run my Rider project with the same name without any errors.

Error when Publishing to Amazon Web Services from Visual Studio

When I try to deploy directly to AWS from visual studio, this errors occurs:
...building deployment package 'C:\Users\Leon\AppData\Local\Temp\AWSDeploymentArchive_*****_v20190509101556.zip'
...invoking 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe -verb:sync -source:manifest="C:\Users\Leon\AppData\Local\Temp\tmp2223.tmp" (...)
...error, package 'C:\Users\Leon\AppData\Local\Temp\AWSDeploymentArchive_*****_v20190509101556.zip' could not be found
...build fail, unable to find expected deployment package.
...build of project archive failed, abandoning deployment
I have tried to manually create the folder, It builds the package, but the result is a empty folder.

Teamcity Nuget Publish to Octopus Repository(built in) fails with 503 error

I have an AsP.net Website with nuspec file set up on teamcity.I have basically defined two build steps.
1. Nuget Pack
2. Nuget Publish.
The nuget package gets created successfully, but I get a 503 error whilst trying to
run the Nuget publish step.
Here is the teamcity publish settings
the error returned is as follows:
[push] An error was encountered when fetching 'PUT https://myoctopusdeployrepo/nuget/packages/'. The request will now be retried.
[10:08:14][push] An error occurred while sending the request.
[10:08:14][push] The remote server returned an error: (503) Server Unavailable.
I know the push to the built in octopus repository works at least for asp.net csharp projects using .csproj and octopack , but i get this error when trying to push a package that was generated from a nuspec file.
Perhaps there is something I'm missing out in the settings ?
Whilst researching and trying out certain other build steps, I came across the 'Octopus Deploy: Push Packages' build step ( Teamcity 2018.2). This runs octo.exe which will need to be installed on the build agent(Octopus deploy commandLine tool) . This plugin is available on the octopus deploy website.
the command as listed in the log is as below
octo.exe push --server http://octopusdeployserver --apikey SECRET --package <package url>
I hope this helps.

Deploy Azure WebJob using VSTS

I'm having some issues deploying an Azure WebJob using Visual Studio Team Services (VSTS).
The WebJob seems to be deployed successfully but it breaks the Azure website that is hosted in the same App Service! I don't have this problem if I deploy using VS2013.
This is my build task that generates the WebJob deployment package:
And this is my deployment task:
There are no errors when I deploy the Azure WebJob. If I go to the Azure Portal I see the WebJob is there, and it runs successfully. WebJob files are copied into the wwwroot\App_Data\jobs\triggered\RemoveExpiredDids folder as expected, but the problem is that some other files will be copied into the wwwroot\App_Data\bin folder, which will break the existing website that was already deployed into that App Service!!!
So I decided to find out why this was happening. After downloading and extracting the deployment package I saw there are 2 folders (app_data and bin) and the scheduler file (settings.job):
This explains why some assemblies are coppied into the wwwroot\App_Data\bin of the App Service. The strange thing is that this doesn't happen when deploying from VS2013!!! I took a look into the MSBuild log and found the following line:
Object dirPath ([app service name]\bin) skipped due to skip directive 'SkipBinFolderOnDeploy'.
Concluding, bin folder is included when deploying the Azure WebJob from VSTS but is excluded when deploying it from VS2013.
So my question is: how to prevent the bin folder from being deployed when using VSTS? Is there any MSBuild parameter/flag to do this?
I've had issue with this particular problem as well.
The latest method I found is using Web Deploy Operation Settings , -skip:Directory= (in this case it would be -skip:Directory='\\bin') when you create your azure deploy task in the release definition (Additional arguments). I've seen that this indeed excludes the bin folder from the update actions (result).
Let me know if this helps you in any way.
Refer to these ways to deploy webjob to azure:
Modify Visual Studio Build task to deploy webjob with FileSystem (MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\WebJob" /p:DeployDefaultTarget=WebPublish)
Add Delete Files task to release definition to delete bin folder (Source Folder: $(System.DefaultWorkingDirectory)/WebJobVnext/drop/WebJob); Contents:bin)
Modify Azure App Service Deploy task (1. Uncheck Publish using Web Deploy option. 2. Package or folder: $(System.DefaultWorkingDirectory)/[artifact name] /drop/WebJob)
I was finally able to fix it, thanks #starain-MSFT for pointing me in the right direction. I had to make some minor changes, though. This is the task that creates the deployment package:
MSBuild arguments:
/p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:DeployDefaultTarget=WebPublish /p:Configuration=$(BuildConfiguration) /p:OutputPath=.\bin\ /p:publishUrl="$(build.artifactstagingdirectory)\temp\WebJob"
The difference here comparing to #starain-MSFT answer is that I had to add the /p:OutputPath= parameter, otherwise I'd get the following error:
The OutputPath property is not set for project
After generating the package, I delete the bin folder and zip it (this reduces the build time).
This is my deployment task:
Please note that $(DeploymentPackagePath) is the path to the zip file that contains the deployment package, as mentioned before. It doesn't matter if you deploy the package as a zip file or if you unzip it and deploy the folder, it works both ways.

Compilation error when publishing a ClickOnce application using MSBuild on CI server

I have a windows form application and I'm trying to publish it using ClickOnce with MSbuild.
When I publish it locally, it works fine, but when I run the same script on my CI server it fails with this compilation error:
error rsInvalidReportDefinition: The report definition is not valid.
Details: The report definition has an invalid target namespace
'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition'
which cannot be upgraded.
Also, when I publish it using Visual Studio on the server, it works just fine... it's the msbuild call that fails.
My publish target is:
<MSBuild Projects="#(Project)" Targets="Publish" Properties="PublishDir=%(PublishDir.FullPath);Configuration=$(Configuration)"/>
What am I missing?
Thanks in advance.

Resources