Build and Test - mattchenderson/microsoft-identity-web GitHub Wiki

Build and test

Clone the repo

  1. Navigate to the main page for the Microsoft Identity Web repo.

  2. From the GitHub UI, click clone or download.

  3. Alternatively open a dev command line and run:

    git clone https://github.com/AzureAD/microsoft-identity-web.git
    

The project is cloned into a local folder.

Build it

  1. Open Microsoft.Identity.Web.sln and build it in Visual Studio 2019. Note the Troubleshooting building in Visual Studio section below.

  2. Alternatively, open a dev command line and build with

    dotnet build Microsoft.Identity.Web.sln
    

    or just,

    dotnet build
    

Run unit tests

You won't be able to run the Integration tests because they require access to a Microsoft Key Vault which is locked down. These tests run daily as part of our Azure DevOps pipelines.

To run the unit tests from the assembly Microsoft.Identity.Web.Test. For this:

cd tests\Microsoft.Identity.Web.Test
dotnet test

Package Microsoft.Identity.Web

From Visual Studio or from the command line. If you wish to control the versioning, use the p:ClientSemVer property

dotnet pack -p:ClientSemVer=1.0.0

If you executed the command above, you'll find the NuGet packages generated under:

  • src\Microsoft.Identity.Web\bin\Debug\Microsoft.Identity.Web.1.0.0.nupkg
  • src\Microsoft.Identity.Web.UI\bin\Debug\Microsoft.Identity.Web.UI.1.0.0.nupkg
  • ProjectTemplates\bin\Debug\Microsoft.Identity.Web.ProjectTemplates.0.x.y.nupkg

The symbols are also generated:

  • src\Microsoft.Identity.Web\bin\Debug\Microsoft.Identity.Web.1.0.0.snupkg
  • src\Microsoft.Identity.Web.UI\bin\Debug\Microsoft.Identity.Web.UI.1.0.0.snupkg

Package the project templates

The dotnet core project templates used to create web apps and web APIs leveraging the Microsoft identity platform are generated by the dotnet pack command above.

If you only want to generate these:

cd ProjectTemplates
dotnet pack

Optionally install the project templates on your machine

cd ProjectTemplates\bin\debug
dotnet new -i Microsoft.Identity.Web.ProjectTemplates.0.x.y.nupkg

If, later, you want to uninstall them:

cd ProjectTemplates\bin\debug
dotnet new -u Microsoft.Identity.Web.ProjectTemplates

Note the subtlety: to uninstall the project templates, you don't provide the full name of the file, but only the name without the version and the extension.

Troubleshooting building with Visual Studio

For the moment, Microsoft.Identity.Web leverages a preview version of .NET 5.0. To build in Visual Studio, you will need to enable Visual Studio to use preview SDKs. For this go to Tools | Options | Environment| Preview features | Use previews of the .NET Core SDK (requires restart), and restart Visual Studio.

image