nuget pack task in Azure Dev ops pipeline gives error - azure-devops

Hi i'm a newbie to azure devops CID and pipelining.
the azure devops is on premise, my pipeline looks as below however it fails at nuget pack command (2nd from bottom)
the error i get is ##[error]The nuget command failed with exit code(1) and error(Error NU5012: Unable to find 'C:\AzureDevOpsAgents\Agent#1_work\4\s\Code\MyCompany.Core\bin\release\net472\MyCompany.Core.dll'. Make sure the project has been built.
I went into the azure agents directory and the dll is located C:\AzureDevOpsAgents\Agent#1_work\4\s\Code\MyCompany.Core\bin\x64\Release\net472\MyCompany.Core.dll
the difference being the x64, so how i can i get nuget pack to take into consideration the architecture as part of the pack path
variables

ok i as usual every time i post a question on here, despite struggling for hours i manage to solve it.
I've added $(BuildPlatform)\ in front of the default $(BuildConfiguration) for the configuration to package and i can see a package in the location

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):

Build is successful on my local but not on vsts azure DevOps

I can successfully build my project on local. When I do via VSTS then build is not successful. I get an error message that a dll cannot be found in my sub project. And it is Rapportage.Logic. The missing dll is used by Rapportage.Logic
Does anyone know the reason?
Most of the time this type of error comes down to:
files present/edited on developer machine but not commited (usually the .csproj file)
subtle differences between Visual Studio build and MSBuild.
I would try the following:
copy the MSBuild command from Azure DevOps logs (the line containing MSBuild.exe)
change the paths in the command to match your dev environment (e.g d:\a\1\s to c:\code\myproject)
run this command
If this command fails with the same error as the build you the problem is a difference between MSbuild and Visaul Studio.
If it succeeds, you most likely have missed a commit.
Build is successful on my local but not on vsts azure DevOps
It depends on how you add ReportViewer references.
If you add the ReportViewer reference manually, you need add the ReportViewer reference to the solution/project folder, then add the reference from that folder. In this case, the path of references are not hard-coded paths. Besides, you need add those/this ReportViewer reference to the source control and submit to the Azure devops repos.
If you add the ReportViewer reference by nuget, you need add the nuget restore task to restore those nuget packages. I could see you are using nuget restore task from your build log (The second image.), but on the build definition, I did not see you have add that task (The 3rd, 4th images.). So, make sure you have restore those packages when you build on the Azure devops, and you could check the restore task if those nuget packages are restored.
Hope this helps.

Multi Platform Nuget using VSO

I am trying to automate the generation of the following NuGet package using VSO:
NuGet Package
My problem is that all three "runtimes" libraries are built on different platforms. Hence, I have the following build configuration in VSO:
VSO Build
When build is completed, each agent job publish a native artifact for its platform:
Native Artifacts
My question is: Is it possible to add a 4th agent job to the build that would wait for all the other jobs and then aggregate the artifacts and generate the NuGet package with everything?
Currently, I need to manually download the artifacts and run a script to pack and sign the NuGet package. It's annoying because it require to install a certificate on my local machine and install the signing tools etc.
Thanks!
Your looking for the "Run this Job" setting on the 4th agent job. "Only When all previous jobs are complete" sounds like the value you want. You could then use powershell and/or the NuGet task to automate your process.

JFrog CLI is giving me a "Wrong number of arguments" error using the Artifactory Maven build step in Azure DevOps (VSTS)

I'm new to Azure DevOps (VSTS) and I'm attempting to set up a new Pipeline build using the Artifactory Maven build step. When running the build I get the following error:
2018-09-12T20:59:02.0861829Z ##[error]Error: Command failed: D:\a_jfrog\1.19.1\jfrog.exe rt mvn "install -f D:\a\1\s\pom.xml" D:\a\1\s\config --build-name="SomeProject-Maven-CI" --build-number="20180912.6"
2018-09-12T20:59:02.0988256Z [Error] Wrong number of arguments. You can read the documentation at https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
I found this info on GitHub: https://github.com/jfrog/jfrog-cli-go/issues/165
Its a similar error but not quite the same. I'm not sure how to edit the command that Azure Pipeline is running or even if I can.
I figured out my issue. I had a space included in my build name and it apparently the JFrog Cli didn't like that. When I removed the space the error went away. Other errors came up but that's off-topic from this question.
Can you please report the errors your encountered in Artifactory VSTS extension's GitHub repository?
We'll really appreciate it.
Update: A pull request opened to target this issue. You can track it here.
Update 2: Fixed in latest release 1.4.0.