Summary: Guest blogger, Gary Jackson, shares a technique to automate Active Directory accounts. Microsoft Scripting Guy, Ed Wilson, is here. I met Gary Jackson at the Windows PowerShell Summit in April. We talked about some cool things he has been working. Windows/shell.exec: Open a File or URL using Windows File Associations Description Usage Arguments Details Value Author(s) See Also Examples Description. Opens the specified file or URL using the application specified in the Windows file associations.

Arduino Libraries

Libraries are files written in C or C++ (.c, .cpp) which provide your sketches with extra functionality (e.g. the ability to control an LED matrix, or read an encoder, etc.). They were introduced in Arduino 0004.

To use an existing library in a sketch simply go to the Sketch menu, choose 'Import Library', and pick from the libraries available. This will insert an #include statement at the top of the sketch for each header (.h) file in the library's folder. These statements make the public functions and constants defined by the library available to your sketch. They also signal the Arduino environment to link that library's code with your sketch when it is compiled or uploaded.

User-created libraries as of version 0017 go in a subdirectory of your default sketch directory. For example, on OSX, the new directory would be ~/Documents/Arduino/libraries/. On Windows, it would be My DocumentsArduinolibraries. To add your own library, create a new directory in the libraries directory with the name of your library. The folder should contain a C or C++ file with your code and a header file with your function and variable declarations. It will then appear in the Sketch Import Library menu in the Arduino IDE.

Note: for users of versions previous to 0017, libraries belong in a subdirectory of the Arduino application directory: ARDUINO/lib/targets/libraries. For version 0017, the libraries directory was moved to make them more convenient to install and use.

Because libraries are uploaded to the board with your sketch, they increase the amount of space used by the ATmega8 on the board. See the FAQ for an explanation of various memory limitations and tips on reducing program size. If a sketch no longer needs a library, simply delete its #include statements from the top of your code. This will stop the Arduino IDE from linking the library with your sketch and decrease the amount of space used on the Arduino board.

To get started writing libraries, download this test library. It should provide a basic template for creating a new library. After you've made changes to your library, in order to get it to recompile, you will have to delete the .o file generated in the library's directory.

-->

Azure Pipelines Azure DevOps Server 2019 TFS 2018 TFS 2017

Use a pipeline to automatically build and test your .NET Core projects. After those steps are done, you can then deploy or publish your project.

Note

In Microsoft Team Foundation Server (TFS) 2018 and previous versions,build and release pipelines are called definitions,runs are called builds,service connections are called service endpoints,stages are called environments,and jobs are called phases.

Note

This guidance applies to TFS version 2017.3 and newer.

Create your first pipeline

Are you new to Azure Pipelines? If so, then we recommend you try this section before moving on to other sections.

Get the code

Import this repo into your Git repo in Azure DevOps Server 2019:

Sign in to Azure Pipelines

Sign in to Azure Pipelines. After you sign in, your browser goes to https://dev.azure.com/my-organization-name and displays your Azure DevOps dashboard.

Within your selected organization, create a project. If you don't have any projects in your organization, you see a Create a project to get started screen. Otherwise, select the Create Project button in the upper-right corner of the dashboard.

Create the pipeline

  1. Sign in to your Azure DevOps organization and navigate to your project.

  2. Go to Pipelines, and then select New Pipeline.

  3. Walk through the steps of the wizard by first selecting GitHub as the location of your source code.

    Note

    If this is not what you see, then make sure the Multi-stage pipelines experience is turned on.

  4. You might be redirected to GitHub to sign in. If so, enter your GitHub credentials.

  5. When the list of repositories appears, select your repository.

  6. You might be redirected to GitHub to install the Azure Pipelines app. If so, select Approve and install.

When the Configure tab appears, select ASP.NET Core.

  1. When your new pipeline appears, take a look at the YAML to see what it does. When you're ready, select Save and run.

  2. You're prompted to commit a new azure-pipelines.yml file to your repository. After you're happy with the message, select Save and run again.

    If you want to watch your pipeline in action, select the build job.

    You just created and ran a pipeline that we automatically created for you, because your code appeared to be a good match for the ASP.NET Core template.

    You now have a working YAML pipeline (azure-pipelines.yml) in your repository that's ready for you to customize!

  3. When you're ready to make changes to your pipeline, select it in the Pipelines page, and then Edit the azure-pipelines.yml file.

  4. See the sections below to learn some of the more common ways to customize your pipeline.

YAML

Directoryu
  1. Add an azure-pipelines.yml file in your repository. Customize this snippet for your build.
  1. Create a pipeline (if you don't know how, see Create your first pipeline), and for the template select YAML.

  2. Set the Agent pool and YAML file path for your pipeline.

  3. Save the pipeline and queue a build. When the Build #nnnnnnnn.n has been queued message appears, select the number link to see your pipeline in action.

  4. When you're ready to make changes to your pipeline, Edit it.

  5. See the sections below to learn some of the more common ways to customize your pipeline.

Classic

  1. Create a pipeline (if you don't know how, see Create your first pipeline), and for the template select Empty Pipeline.

  2. In the task catalog, find and add the .NET Core task. This task will run dotnet build to build the code in the sample repository.

  3. Save the pipeline and queue a build. When the Build #nnnnnnnn.n has been queued message appears, select the number link to see your pipeline in action.

    You now have a working pipeline that's ready for you to customize!

  4. When you're ready to make changes to your pipeline, Edit it.

  5. See the sections below to learn some of the more common ways to customize your pipeline.

Build environment

You can use Azure Pipelines to build your .NET Core projects on Windows, Linux, or macOS without needing to set up any infrastructure of your own.The Microsoft-hosted agents in Azure Pipelines have several released versions of the .NET Core SDKs preinstalled.

Update the following snippet in your azure-pipelines.yml file to select the appropriate image.

See Microsoft-hosted agents for a complete list of images and Pool for further examples.

The Microsoft-hosted agents don't include some of the older versions of the .NET Core SDK.They also don't typically include prerelease versions. If you need these kinds of SDKs on Microsoft-hosted agents, add the .NET Core Tool Installer task to the beginning of your process.

If you need a version of the .NET Core SDK that isn't already installed on the Microsoft-hosted agent, add an extra step to your azure-pipelines.yml file. To install the 3.0.x SDK for building and 2.2.x for running tests that target .NET Core 2.2.x, add this snippet:

If you are installing on a Windows agent, it will already have a .NET Core runtime on it. To install a newer SDK, set performMultiLevelLookup to true in this snippet:

Tip

As an alternative, you can set up a self-hosted agent and save the cost of running the tool installer.You can also use self-hosted agents to save additional time if you have a large repository or you run incremental builds. A self-hosted agent can also help you in using the preview or private SDKs thats are not officially supported by Azure DevOps or you have available on your corporate or on-premises environments only.

You can build your .NET Core projects by using the .NET Core SDK and runtime on Windows, Linux, or macOS.Your builds run on a self-hosted agent.Make sure that you have the necessary version of the .NET Core SDK and runtime installed on the agent.

Restore dependencies

NuGet is a popular way to depend on code that you don't build. You can download NuGet packages by runningthe dotnet restore command either through the.NET Core task or directly in a script in your pipeline.

You can download NuGet packages from Azure Artifacts, NuGet.org, or some other external or internal NuGet repository.The .NET Core task is especially useful to restore packages from authenticated NuGet feeds.

dotnet restore internally uses a version of NuGet.exe that is packaged with the .NET Core SDK. dotnet restore can only restore packages specified in the .NET Core project .csproj files.If you also have a Microsoft .NET Framework project in your solution or use package.json to specify your dependencies, you must also use the NuGet task to restore those dependencies.

In .NET Core SDK version 2.0 and newer, packages are restored automatically when running other commands such as dotnet build.

In .NET Core SDK version 2.0 and newer, packages are restored automatically when running other commands such as dotnet build.However, you might still need to use the .NET Core task to restore packages if you use an authenticated feed.

If your builds occasionally fail when restoring packages from NuGet.org due to connection issues,you can use Azure Artifacts in conjunction with upstream sourcesand cache the packages. The credentials of the pipeline are automatically used when connectingto Azure Artifacts. These credentials are typically derived from the Project Collection Build Serviceaccount.

If you want to specify a NuGet repository, put the URLs in a NuGet.config file in your repository.If your feed is authenticated, manage its credentials by creating a NuGet service connection in the Services tab under Project Settings.

If you use Microsoft-hosted agents, you get a new machine every time your run a build, which means restoring the packages every time.This restoration can take a significant amount of time. To mitigate this issue, you can either use Azure Artifacts or a self-hosted agent, in which case,you get the benefit of using the package cache.

To restore packages from a custom feed, use the .NET Core task:

For more information about NuGet service connections, see publish to NuGet feeds.

  1. Select Tasks in the pipeline. Select the job that runs your build tasks. Then select + to add a new task to that job.

  2. In the task catalog, find and add the .NET Core task.

  3. Select the task and, for Command, select restore.

  4. Specify any other options you need for this task. Then save the build.

Dev C User Default Directory Windows 10

Note

Make sure the custom feed is specified in your NuGet.config file and that credentials are specified in the NuGet service connection.

Build your project

You build your .NET Core project either by running the dotnet build command in your pipeline or by using the .NET Core task.

To build your project by using the .NET Core task, add the following snippet to your azure-pipelines.yml file:

You can run any custom dotnet command in your pipeline. The following example shows how to install and use a .NET global tool, dotnetsay:

Build

  1. Select Tasks in the pipeline. Select the job that runs your build tasks. Then select + to add a new task to that job.

  2. In the task catalog, find and add the .NET Core task.

  3. Select the task and, for Command, select build or publish.

  4. Specify any other options you need for this task. Then save the build.

Install a tool

To install a .NET Core global tool like dotnetsay in your build running on Windows, take the following steps:

  1. Add the .NET Core task and set the following properties:

    • Command: custom.
      • Path to projects: leave empty.
    • Custom command: tool.
    • Arguments: install -g dotnetsay.
  2. Add a Command Line task and set the following properties:

    • Script:dotnetsay.

Run your tests

If you have test projects in your repository, then use the .NET Core task to run unit tests by using testing frameworks like MSTest, xUnit, and NUnit. For this functionality, the test project must reference Microsoft.NET.Test.SDK version 15.8.0 or higher.Test results are automatically published to the service. These results are then made available to you in the build summary and can be used for troubleshooting failed tests and test-timing analysis.

Add the following snippet to your azure-pipelines.yml file:

An alternative is to run the dotnet test command with a specific logger and then use the Publish Test Results task:

Use the .NET Core task with Command set to test.Path to projects should refer to the test projects in your solution.

Collect code coverage

If you're building on the Windows platform, code coverage metrics can be collected by using the built-in coverage data collector. For this functionality, the test project must reference Microsoft.NET.Test.SDK version 15.8.0 or higher.If you use the .NET Core task to run tests, coverage data is automatically published to the server. The .coverage file can be downloaded from the build summary for viewing in Visual Studio.

Add the following snippet to your azure-pipelines.yml file: Traktor pro dj setup.

If you choose to run the dotnet test command, specify the test results logger and coverage options. Then use the Publish Test Results task:

  1. Add the .NET Core task to your build job and set the following properties:

    • Command: test.
    • Path to projects: Should refer to the test projects in your solution.
    • Arguments: --configuration $(BuildConfiguration) --collect 'Code coverage'.
  2. Ensure that the Publish test results option remains selected.

Collect code coverage metrics with Coverlet

If you're building on Linux or macOS, you can use Coverlet or a similar tool to collect code coverage metrics.

Code coverage results can be published to the server by using the Publish Code Coverage Results task. To leverage this functionality, the coverage tool must be configured to generate results in Cobertura or JaCoCo coverage format.

To run tests and publish code coverage with Coverlet, add this snippet to your azure-pipelines.yml file:

Package and deliver your code

After you've built and tested your app, you can upload the build output to Azure Pipelines or TFS, create and publish a NuGet package,or package the build output into a .zip file to be deployed to a web application.

Publish artifacts to Azure Pipelines

To publish the output of your .NET build,

  • Run dotnet publish --output $(Build.ArtifactStagingDirectory) on CLI or add the DotNetCoreCLI@2 task with publish command.
  • Publish the artifact by using Publish artifact task.

Add the following snippet to your azure-pipelines.yml file:

Note

The dotNetCoreCLI@2 task has a publishWebProjects input that is set to true by default. This publishes all web projects in your repo by default. You can find more help and information in the open source task on GitHub.

To copy additional files to Build directory before publishing, use Utility: copy files.

Dev C User Default Directory Password

Publish to a NuGet feed

To create and publish a NuGet package, add the following snippet:

For more information about versioning and publishing NuGet packages, see publish to NuGet feeds.

Deploy a web app

To create a .zip file archive that's ready for publishing to a web app, add the following snippet:

To publish this archive to a web app, see Azure Web Apps deployment.

Publish artifacts to Azure Pipelines

To simply publish the output of your build to Azure Pipelines or TFS, use the Publish Artifacts task.

Publish to a NuGet feed

If you want to publish your code to a NuGet feed, take the following steps:

  1. Use a .NET Core task with Command set to pack.

  2. Publish your package to a NuGet feed.

Deploy a web app

  1. Use a .NET Core task with Command set to publish.

  2. Make sure you've selected the option to create a .zip file archive.

  3. To publish this archive to a web app, see Azure Web Apps deployment.

Build an image and push to container registry

For your app, you can also build an image and push it to a container registry.

Troubleshooting

Dev C User Default Directory Page

If you're able to build your project on your development machine, but you're having trouble building it on Azure Pipelines or TFS, explore the following potential causes and corrective actions:

  • We don't install prerelease versions of the .NET Core SDK on Microsoft-hosted agents. After a new version of the .NET Core SDK is released,it can take a few weeks for us to roll it out to all the datacenters that Azure Pipelines runs on. You don't have to wait for us to finishthis rollout. You can use the .NET Core Tool Installer, as explained in this guidance, to install the desired version of the .NET Core SDKon Microsoft-hosted agents.
  • Check that the versions of the .NET Core SDK and runtime on your development machine match those on the agent.You can include a command-line script dotnet --version in your pipeline to print the version of the .NET Core SDK.Either use the .NET Core Tool Installer, as explained in this guidance, to deploy the same version on the agent,or update your projects and development machine to the newer version of the .NET Core SDK.

  • You might be using some logic in the Visual Studio IDE that isn't encoded in your pipeline.Azure Pipelines or TFS runs each of the commands you specify in the tasks one after the other in a new process.Look at the logs from the Azure Pipelines or TFS build to see the exact commands that ran as part of the build.Repeat the same commands in the same order on your development machine to locate the problem.

  • If you have a mixed solution that includes some .NET Core projects and some .NET Framework projects,you should also use the NuGet task to restore packages specified in packages.config files.Similarly, you should add MSBuild or Visual Studio Build tasks to build the .NET Framework projects.

  • If your builds fail intermittently while restoring packages, either NuGet.org is having issues, or there arenetworking problems between the Azure datacenter and NuGet.org. These aren't under our control, and you mightneed to explore whether using Azure Artifacts with NuGet.org as an upstream source improves the reliability of your builds.

  • Occasionally, when we roll out an update to the hosted images with a new version of the .NET Core SDK or Visual Studio,something might break your build. This can happen, for example, if a newer version or feature of the NuGet toolis shipped with the SDK. To isolate these problems, use the .NET Core Tool Installer task to specify the versionof the .NET Core SDK that's used in your build.

Q&A

User

Where can I learn more about Azure Artifacts and the TFS Package Management service?

Where can I learn more about .NET Core commands?

Where can I learn more about running tests in my solution?

Where can I learn more about tasks?