Error when Publishing to Amazon Web Services from Visual Studio - 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.

Related

MSB4019 VSTO targets not found TeamCity build agent

I'm using a TeamCity build server to try and build an Outlook Addin, I can build & test the code using TeamCity, but when it comes to publishing the app to a folder I get the following error.
Obviously the build server is missing some SDK components to complete the package\publish step.
Does anyone know which Windows SDK I need to get installed on the build server?
Nothing to do. None of the projects specified contain packages to restore.
XXXXXXXX.Outlook.csproj(331,3): error MSB4019:
The imported project "C:\Program Files\dotnet\sdk\7.0.102\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found.
Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\7.0.102\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" is correct, and that the file exists on disk.
Build FAILED.

Azure devops failing to build visual studio sql database project: SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found

I have a sql database project in Visual Studio (2019).
I am trying to deploy it via azure devops.
The pipeline is failing due to the below error:
##[error]C:\azagent\A1_work\r1\a_Transcripts-SQLDeployment\SampleDatabaseProject\SampleDatabaseProject\SampleDatabaseProject.sqlproj(117,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk
The project builds without issue on my pc.
In the pipeline I have tried both the MSBuild and Visual Studio Build tasks, but the result is the same in each case.
Steps tried:
I found the reference in the sqlproj file xml, and removed it but this did not resolve the issue.
Appreciate any expertise on how to resolve this.

Azure functions publish does not copy all files

When I publish my azure functions to azure not all of my referenced packages are being copied. I thus get an error stating that a specific file (Microsoft.CodeAnalysis.dll) cannot be found.
I have made sure that the package is referenced in my azure function project:
and have checked that it is in the .csproj file:
When I build locally the file is included in the \bin directory:
but when I publish to azure the file is missing:
This gives me run time error when the file is referenced:
How do I force the file to be included in the publish to azure, there is no option to "copy to output directory", or similar, in this instance in Visual Studio:
This problem is resolved in Azure Functions (.NET 5.0) but in .NET Core 3.1 use
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
in the project file of Azure Functions as a workaround. Please find the details https://github.com/Azure/Azure-Functions/issues/1525

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.

MVC6 app VSO build and deployment to Azure fails

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!

Resources