Error on Azure DevOps pipeline for Windows form application - azure-devops

I am setting up build pipeline for Windows form application on azure devops with MSBuild arguments: /target:publish /p:ApplicationVersion="$(Build.BuildNumber)". I am getting error below but the transformation files should not be included in the build so I am not able to find why publish is looking for this file.
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5327,5): Error MSB3030: Could not copy the file "bin\app.DEV.config" because it was not found.

Related

How to build Visual Studio Installer Project in Azure Pipelines in Self-Hosted Windows Agent

The image above shows my Hello World project structure. I am trying to build the Setup-HelloWorld-x86.vdproj in Azure Pipeline in Self-Hosted Windows Agent (which is nothing but my local machine) by using the command line script task like shown in below image.
But I get the following error.
Kindly help me to build this Setup-HelloWorld-x86.vdproj
If you want to run the project via cmd devenv, you can refer to this doc.
As a workaround, you can install the extension Build VS Installer and use the task DutchWorkz - Build VS Installer(s) to build Visual Studio Installer Project in Azure Pipelines.
You can specify to build .sln or .vdproj to generate .msi file(s) in Task-mode option.
Update1
Thanks Tharunavignesh J for sharing.
The solution was to run the azure agent under proper account. Earlier my azure agent was running under some Network Service account, then I change it to the local account, then this cmd worked properly.
This other stack overflow link helped me get my visual studio installer project compiled with Azure DevOps pipelines. It is using yaml configuration instead of classic, but same steps / commands apply to both:
YAML Script for building Visual Studio Installer Projects using Azure DevOps
Basically the steps are:
Setup your variables to point to the tools
Download Nuget packages for your solution
Disable Out Of Process Builds command executed
Script task with the command line arguments to build your solution

Build failing while creating Azure Build pipeline - Error MSB3073 - VSBuild Task

We were trying to build a pipeline using MS Hosted agent with vmImage (vs2017-win2016) for a .net application, but build id is failing with following errors..Any ideas? Now, same source code successfully builds on On-premise build server & since we are now using Azure Devops to create build pipeline using MS Hosted agent, its failing.
This is the only build error we are getting right now. Any valuable comments or inputs highly appreciated.
Error details are as below:
Error analysis
Build solution (VSBuild) - VSBuild Task
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5165,5): Error MSB3073: The command "copy "D:\a\1\s\Modules\HP.AMI.Modules.VirtualHeadEnd\ResponseTemplates*.xml" C:\AMI\Templates " exited with code 1.
Build failing while creating Azure Build pipeline - Error MSB3073 - VSBuild Task
When you got the MSBuild error MSB3073, that means the path of the custom command line or custom target in your project is not correct. You need to check the path of that command line.
According the comment you replied, you have post-build event command line:
copy "$(ProjectDir)ResponseTemplates*.xml" C:\AMI\Templates
When you execute this command line without existing folder C:\AMI\Templates, the copy command will report an error of Error MSB3073. Because the target folder cannot be found.
To resolve this issue, we just need to add another post-build event command line to create the folder before the copy command line, like:
md C:\AMI\Templates
copy "$(ProjectDir)TextTemplate1.txt" "C:\AMI\Templates"
Now, we could build it with hosted agent vmImage (vs2017-win2016):

Azure agent: where to find SqlPackage.exe

I use a Microsoft hosted agent for building and verifying my project including an sql project.
On this azure agent I need to find the SqlPackage.exe file to call it via a powershell task. I know that there is the SqlServerDacpacDeployment task but that does not satisfy my needs. I also know that the SqlPackage.exe has to be somewhere because the SqlServerDacpacDeployment task can run without the failure that it can not find the SqlPackage.exe file.
Does anybody know where it is installed on an agent with vmImage: 'VS2017-Win2016' or how to located it?
For VS2017-Win2016 agent:
You can find the SqlPackage.exe under path C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\
This is also the installation path in local machine. For devops, you can use CMD task with content below to check whether the SqlPackage.exe exists there:
C:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\
dir
Check the log and you'll find:
And for Windows-2019, just use 2019 instead of 2017 in the path above.

ClickOnce deployment on Azure DevOps release pipeline

I am trying to create ClickOnce deployment on Azure DevOps release pipeline
I create signature, manifest, application, deploy files with certificate
But how can I create the exe and setup file (via Azure DevOps release pipeline)
But how can I create the exe and setup file (via Azure DevOps release
pipeline)
Check document Build ClickOnce applications from the command line: Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. See similar hint here.
And all above is about doing that in local machine, to do similar job in release pipeline you can use msbuild task or Visual Studio Task with Publish target(/t:Publish as argument).
Then you'll get one app.publish folder where the files you want exist there:
This folder can be used for your further deployment.
In addition:
If you meet error like Unable to find manifest signing certificate in the certificate store, please check the suggestions in this issue.

Deploying AzureDevOps Build Artifacts

I have a solution in Azure Devops. This is for Azure function. I am using the build pipeline to generate a artifact. This artifact I need to deploy it through powershell, I am using kudo API to deploy this.
https://$appName.scm.azurewebsites.net/api/zipdeploy
The issue is the format which Azure DevOps generates completely different from msdeploy in visual studio generates. When I deploy the zip file generated from vs it gets deployed correctly. Can I make Azure Devops to generate the Artifact same as visual studio
Adding more information as per comment
I am using Visual Studio Build Task to generate build and Publish task to publish artifact
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
The generated artifact with zip has a high depth something like "\publish\Content\D_C\a\1\s\src\aadsr\aadsr\obj\Release\net461\PubTmp\Out".
I just want the zip file should have content of Out folder, which I directly want to publish to a function APP