In order to allow streamlined dogfooding of upcoming Roslyn features, we provide two mechanisms that are used in conjuntion and are automatically available for all feature branches:
- A CI nuget feed at https://roslyn.blob.core.windows.net/nuget/index.json
- A VSIX gallery feed at https://roslyn.blob.core.windows.net/vsix/[feature]/atom.xml
To get both a feature branch's IDE as well as compiler support, you need to install a matching IDE extension as well as configure and install the specific version of the compilers compiled for that same feature, as explained in the docs on contributing.
The feeds allow you to consume the CI produced artifacts from a feature branch without having to clone and build locally.
In addition, a permalink is also provided to the latest VSIX from the currently branch or alternatively from any branch by using https://roslyn.azurewebsites.net/latest?FEATURE (such as https://roslyn.azurewebsites.net/latest?records).
To consume the compiler (and any other packages you might depend on), add the following package source to your NuGet.Config:
<add key="roslyn" value="https://roslyn.blob.core.windows.net/nuget/index.json" />To always reference the latest compiler toolset for a feature branch named
features/records, for example, you can use a wildcard like:
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.7.0-ci.records.*" />The label suffix after -ci. will match the branch name after features/ in
the repository.
The wildcard can be replaced with a particular build version if you want an exact match (i.e. to be tied to the installed VSIX too).
Visual Studio makes it easy to add custom gallery feeds for installing and updating extensions outside of the marketplace.
Unlike the nuget packages where you can easily pick which feature you want
to install by appending the right label suffix after -ci., the Extension
Manager does not allow selection of different versions of the same extension
from a feed. So you need different feeds for each.
You pick the feature feed you want by replacing FEATURE with the name of
the feature branch (after features/ in the branch name) in the URL
https://roslyn.blob.core.windows.net/vsix/FEATURE/atom.xml
This section documents how to set up the DevOps and Azure resources in order to self-host the feeds and nuget packages.
- Optionally (but recommended) create a separate Resource Group to contain all resources that will handle the feeds (i.e. Azure Function and Blob Storage)
- Create an empty Azure Functions App, choose .NET Core runtime
- Create a new storage account (either
StorageV2orBlobStorage) and create three new containers with public read access for blobs access policy:vsix,nugetandlatest.
Both the function app and the build pipelines need access to the storage
account, via a FeedStorageConnectionString setting. You can copy/paste
the connection string directly as a setting for both, or you can use
Azure KeyVault. This is the recommended approach for maximum security and
policy compliance, and it also facilitates changing that value later on
in a single place.
If you decide to use KeyVault:
- Create a new Azure KeyVault in the same resource group as the rest
- Create a new Secret and set it to the connection string for the
storage account, name it
FeedStorageConnectionString. Copy theSecret IdentifierURI. - In the function app, select the
Identitypane and set Status = On for theSystem assignedidentity. This will allow adding read permissions to the function app on the key vault. - In the
Access policiespane of the key vault, clickAdd Access Policyand create a new policy withGet(key and secret) permissions for the function app principal (search for its app name in the Principal selector) - In the function app, add a new app setting with the following format:
@Microsoft.KeyVault(SecretUri=SECRET_URI). ReplaceSECRET_URIwith the value copied in step 2.
If the value was properly read by the function app, a green checkmark will
appear next to Key vault Reference in the Source column for the setting.
-
Create a new
Service connection(in your DevOps project settings), selectingAzure Resource ManagerandService principal (automatic)and select the subscription and resource group. Name itroslyn-Azure.The pipelines use
roslyn-Azureas the service connection name. You can use a different name, by providing the value via theAzureSubscriptionvariable. -
After saving the connection, click on it to see the Overview/Details pane. Click on
Manage Service Principal, which takes you to Azure AD app registration. Copy theDisplay name -
In the Azure portal, navigate to the storage account, and under the
Access control IAMsection, add a new role assignement. SelectStorage Blob Data Contributorrole, and paste the app registration display name copied above to search for the identity and save.
There are two separate pipelines to set up:
- Uploading to Blob Storage on CI builds
- Deploying Function App
If you're using Azure KeyVault to keep the storage connection string:
- Open the
Librarysection and create a new variable group - Select
Link secrets from an Azure key vault as variablesand link theFeedStorageConnectionString
Steps for setting up the CI pipeline that publishes blobs to storage (both VSIX payloads as well as a serverless nuget feed):
- Create a new YAML-based pipeline, point it to the roslyn repo/fork and let it pick the default yaml from the repo and save it (don't queue a build)
- Click Edit, then the vertical dots button next to
Saveand selectTriggers. This allows non-yaml aspects of the pipeline. - In the
YAMLtab, entersrc/Tools/FeatureFeed/azure-pipelines-function.ymlas the YAML file path andAzure Pipelinesas the default agent pool. Optionally give the pipeline a friendly name. - If you're not using Azure keyvault, create a
FeedStorageConnectionStringvariable and set its value to the storage account connection string. Also set the variable as a secret. If you're using Azure key vault, just link the previously created variable group instead. - Optionally set the value of the
AzureSubscriptionvariable if your service connection name is notroslyn-Azure.
Steps for setting up the CI pipeline that publishes and updates the Azure function app that updates the VSIX feed:
- Create a new YAML-based pipeline, point it to the roslyn repo/fork and let it pick the default yaml from the repo and save it (don't queue a build)
- Click Edit, then the vertical dots button next to
Saveand selectTriggers. This allows non-yaml aspects of the pipeline. - In the
YAMLtab, entersrc/Tools/FeatureFeed/azure-pipelines-function.ymlas the YAML file path andAzure Pipelinesas the default agent pool. Optionally give the pipeline a friendly name. - In the
Variablestab, add a newFunctionAppNameand set the value to the name of the function app you created earlier. - Optionally set the value of the
AzureSubscriptionvariable if your service connection name is notroslyn-Azure.