How to use nuget packages in azure devops? - azure

Im trying to setup a selenium testproject in azure devops, so i can run it in a pipeline.
I created a project in Visual Studio 2017 and everything works fine. When i try to publish my local code into the azure repository, it doesnt upload my nuget packages and selenium doesnt run without them. How can i solve this? I dont have access to Azure Artifacts btw
Im following these tutorials:
https://learn.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops
https://www.youtube.com/watch?v=tcAMgPywsJA

You need to either manually(via command line) or automatically (a pipeline) publish your Nuget package to Azure Artifacts. Checkout Publish a NuGet package.
Once you publish your Nuget package, you won't be able to change its version, or overwrite. Just take in mind.

How can i solve this? I dont have access to Azure Artifacts btw
As a workaround, you can set up self-hosted agent and use it to run the pipeline.
Then set the path to install the package to the path where the local package is located in the nuget.config file.
nuget.config reference

Related

how to make azure devops release pipeline click once

I have a simple executable, that I have build and unittested in a build pipeline.
now I want to install it on some test machines and run some tests on the app, before releasing it to production. (eventually I hope to automate the tests with specflow, but that is the next step)
So basically I have an helloworld.exe build, that I want to be installed from a pipeline to at test agent computer.
I think clickonce is the optimal option, but am unsure how to set it up on azure devops. (we use a server on premises)
Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. Please check document: Create and build a basic ClickOnce application with MSBuild. 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.
Here is a ticket you can refer to .
In addition, azure devops Marketplace provides some extension: ClickOnce Packager, ClickOnceMore DevOps Pipeline Task.

Azure devops - 302 status code when publishing universal package

i am trying to publish artifact from my local host to azure devops as universal package. I downloaded newest azure CLI (2.3.1) installed newest azure devops (0.18.0). After that i logged in using az login and also created my own personal access token and logged in with az devops login command. There were no errors so i assume that i logged in, i also did it with debug enabled and everything went fine.
After that i tried to publish my universal package into artifacts in my project but i got message
Failed to update Universal Packages tooling. Operation returned a 302
status code.
Error screen
In debug mode i've got
failed while trying to get token for tenant {tenant_id}
Later on there was also a retry with PAT but again 302 status from OPTIONS request.
I also tried to do other actions on my account using cli and everything was ok. I removed user from my team and it went smoothly.
Can i ask for help with this issue, if there is other option to publish this package it would be great.
The operation of Package publish from Azure cli need the support of artifacttool, so we combine these 2 operation together. When you run the command of az artifacts universal publish, it will firstly install/update the artifact tool to latest, so that it could make sure the publish action can be smoothly.
Now, the issue you faced is during the artifact tool updating. Not sure what happened on your side since it all work fine for me at present. I did universal package publish very successfully just now.
Work around:
Since you stuck at artifact tool updating, just avoid that. You can do package publish by using Azure devops task.
Just go pipeline, add Universal packages task and then configure it with below arguments:
Then, run this pipeline with self-agent(must). Because your are trying to publish the local files to Azure Universal package, only self-host agent can have ability to access local folder.

Azure Functions with runtime 2; binding extensions not automatically created

When I deploy my Azure Function project to my Function App based on the v2 runtime, the binding extensions my project depend on (Azure Storage in my case), are not automatically created.
I deploy my project with an extensions.csproj file on the root, but after deploying I have to manually run the following command to create a bin and obj folder at wwwroot.
dotnet build extensions.csproj -o bin --no-incremental --packages D:\home\.nuget
If I understand correctly, this should happen automatically.
For deployment by CLI func azure functionapp publish
Function core tools use zip deployment to deploy functions, in this way, kudu doesn't build project by default. To enable the feature, set SCM_DO_BUILD_DURING_DEPLOYMENT to true in Application settings on portal.
As for why the default setting is false, zip deployment usually requires the content to be deployed including all related files hence there's no need to build again.
For Azure function core tools, we usually use command func extensions install to register extensions for input/output binding when extensions are not installed automatically like we create trigger from template. This is why command func start and func azure functionapp publish doesn't build extensions.csproj, extensions are supposed to be installed before we run or publish functions.
Update for DevOps deployment
With Azure pipeline, we need to build extensions.csporj before archive files. Add a .NET Core build task, arguments are -o bin.
If you want kudu to build project, go to Deployment Center under Platform features. Choose VSTS as a CI repository and kudu will build and deploy project for you.
When using Visual Studio, you'll be referencing the extension packages directly from your project in order to use their attributes and other types, so Visual Studio handles the installation process, but registration still needs to be performed.
This is handled by a custom build task, added by the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator NuGet package, which must be explicitly referenced (this will be automatically brought in by the SDK/Visual Studio tools in a future update).
These are the steps you must follow to use the CosmosDB extension mentioned in our previous example:
1.Add a reference to the Microsoft.Azure.WebJobs.Extensions.Storage NuGet package
2.Add a reference to the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator
3.Build the project
For more details, you could refer to this article.

azure pipelines - creating subfolder under wwwroot

I'm setting a CI/CD using Azure Pipelines. As the output of the build, I'm generating a zip file. If I manually upload the produced zip artifact to wwwroot using Kudu, it works fine. However, using the Release of Azure Pipelines, it's creating a new folder and dropping the content into it.
Kudu:
I've tried several different approaches:
-without zipping the output of the build
-using msbuild rather than dotnet build
-deploying using msdeploy
-cloning from existing builds / releases
For all the previous approaches I'm getting the same result: the output inside Backoffice folder. I've found a similar problem on VSTS release pipeline to Azure web app deploys to wwwroot subdirectory but I did the steps described in the answer and I'm still with the problem. Any clues?
I was able to solve this issue using the Zip Deployment from preview version.

Deployment from bitbucket to azure using nuget fails

I'm using NancyFX and I added it to my solution via Nuget.
When I publish the solution to Azure, the solution is compiled and the nancy dlls goes to Azure without problem.
I am also a Bitbucket user, so I give a try to the continuos deployment, but the problem arises because no Nancy.dll is on the server.
Do I need to push the bin dlls to bitbucket?
Can Azure use the Nuget package information to download the external refs?

Resources